Как программно добавить новую вкладку в профиль пользователя


/**
* Implements hook_menu().
*/
function mymodule_menu() {
$items['user/%user/mytab'] = array(
'title' => 'My Tab',
'page callback' => 'mymodule_mytab',
'page arguments' => array(1),
'access arguments' => array('access content'),
'type' => MENU_LOCAL_TASK,
'weight' => 10,
);
return $items;
}

/**
* Page callback
*/
function mymodule_mytab($user) {
return '

' . htmlspecialchars(print_r($user, true)) . '

';
}

Категория: 
The code has been tested and works

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.