1

I dont know what i doing wrong but for reasons the tab on user page doesnt appear! i have like three tabs which i place my self in custom module and they ok.. But now trying to use the principle i used nothing works. below is my code! Any suggestions?

 

$items=array();

$items['user/%user/mysite-news'] = array(
'title' =>t('Мой Новости'),
'description' => t('yo news.'),
'page callback' => 'mysite_news',
'page arguments' => array(1),
'access callback' =>array('view kupon'),
'type' =>MENU_LOCAL_TASK,
);
$items['user/%user/mysite-news/my-news'] = array(
'title' =>t('Мой Новости'),
'description' => t('see your news.'),
'page callback' => 'mysite_news',
'page arguments' => array(1),
'access callback' => TRUE,
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight'=>-15,
);

//and my call back function 
function mysite_news($account){
  $my_name=t('my name is $c',array('$c'=>$account->name));
return $my_name;
}
?>

if i visit the link user/1/mysite-news/my-news

the result is displayed, "my name is admin". But the tab doesnt show on user page.. please help.

1 Answer 1

1

You don't define the 'page callback' for the MENU_DEFAULT_LOCAL_TASK since it is taken care of by the 'root' page, plus without any additional tabs it won't show up anyway. If you add another MENU_LOCAL_TASK it should show up. You can think of the default local task as the page itself, there would be no reason for a VIEW tab there without anything else like EDIT UNPUBLISH etc.

1
  • Thank you for ur suggestion,now its working.The other thing is i replaced 'access callback' =>array('view kupon'); with 'access arguments' => array('view kupon').
    – mrcniceguy
    Mar 6, 2012 at 11:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.