Why is my menu item not showing up?

67 Views Asked by At

I'm trying to create a menu item that changes dynamically according to the logged in user.

Here's the code in my module:

<?php
global $user;
$current_uid = $user->uid;
$current_name - $user->name;
function willmodule_menu(){
$techprofile = 'tech=profile/' . $current_uid . '/' . $current_name;
$items['$techprofile'] = array(
  'menu_name' => 'menu-tech-account-menu',
  'title'=>'View Your Tech Profile',
);
return $items;
}
?>

I have no idea what I'm doing wrong. My menu item isn't even showing up. On the plus side, it's not breaking my site, though.

1

There are 1 best solutions below

1
On

Well there are few things either typos while posting or actual mistakes in code:

   1. $current_name - $user->name; //change dash to = sign?
   2. $items['$techprofile'] //use double quotes instead of single quotes when 
                             //using php variables