Brad Bailosky
Brad Bailosky

Reputation: 1

Add 3 custom menu links to the navigation menu

I am using Drupal 7 and I want to add 3 menu links to the navigation menu. The links are based on the current logged in users 'uid' but I can't get it to work. I have checked this site out and ever example uses a custom module to implement. I am trying to add this to my template.php page.

This is currently what I have.

function mytheme_menu() {
  $items = array();

  $items['user/%uid/following'] = array(
    'title' => 'My Following Content',
    'description' => 'View the item',
    'type' => MENU_NORMAL_ITEM,
    'menu_name' => 'navigation',
    'access callback' => 'user_is_logged_in',  // TRUE, 'user_is_logged_in' or user_is_anonymous to check if logged in
    'expanded' => TRUE,
  );

  $items['user/%uid/created'] = array(
    'title' => 'My Created Content',
    'description' => 'Item members',
    'type' => MENU_NORMAL_ITEM,
    'menu_name' => 'navigation',
    'page callback' => views_page('individual_item', 'item_members'),
    'access callback' => 'user_is_logged_in',  // TRUE, 'user_is_logged_in' or user_is_anonymous to check if logged in
    'expanded' => TRUE,
  );

  $items['user/%uid/interacted'] = array(
    'title' => 'My Interacted Content',
    'description' => 'All the Content for this item',
    'menu_name' => 'navigation',
    'type' => MENU_NORMAL_ITEM,  
    'page callback' => views_page('individual_item', 'item_content'),
    'access callback' => 'user_is_logged_in',  // TRUE, 'user_is_logged_in' or user_is_anonymous to check if logged in
    'expanded' => TRUE,
  );
   return $items;
}

Upvotes: 0

Views: 78

Answers (1)

Scott Anderson
Scott Anderson

Reputation: 1371

You're right there Brad, you can only implement hook_menu() in a custom module.

You can follow something like this to create a simple custom module and put your custom_module_menu() function it the .module file. https://www.drupal.org/node/778734

Upvotes: 0

Related Questions