我正在使用 Drupal 7,我想在导航菜单中添加 3 个菜单链接。这些链接基于当前登录的用户“uid”,但我无法让它工作。我已经检查了这个站点,并且曾经使用自定义模块来实现示例。我正在尝试将此添加到我的 template.php 页面。
这是我目前所拥有的。
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;
}