Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Drupal Basics Writing Modules Your First Module

Greetings module not linked from nav, and page shows Access Denied.

Here is my code:

function greeting_menu() {
    $items = array();
    $items['hello_friend'] = array(
            'title' => "Hello friend!",
            'page_callback' => 'say_hello',
            'access_callback' => TRUE,
            'type' => MENU_NORMAL_ITEM,
    );
    return $items;
}

function say_hello() {
    return '<p>Hello my dear friend.</p>';
}

I followed the steps as shown in the video, and the module is enabled without errors, but the module isn't linked from the homepage as it is in the tutorial, and going to the page directly shows Access Denied. Any ideas?

1 Answer

Ah nevermind -- it should be 'page callback' and 'access callback', not with underscores.