How to edit link tabs found on drupal's default user profile page?

How to edit link tabs found on drupal's default user profile page? I am trying to avoid creating a user_profile.tpl.php file and rebuild the entire profile from scratch. If there is an easier way to do this, I would rather do it. But if I have to create my own template, how do I manage the menu tabs for the profile? I have not yet found the documentation that explains this part.

+4
source share
2 answers

Edit

I did not understand that you wanted to make a general modification of the user profile tabs, without necessarily deleting them. I modified my code to provide several different examples of how you can change tabs.

Edit 2

The user_access() check for unset has been user_access() , since it will be checked only when the menu is recreated. Added access callback example.


You can do this in a custom module with hook_menu_alter() and unset() :

 function mymodule_menu_alter(&$items) { // If you have the Devel module installed, uncomment to retrieve list // of registered menu items to figure out what to unset. // kpr($items); // Change the name of the Edit tab $items['user/%user_category/edit']['title'] = t('Awesome edit!'); // Disable the user edit tab, but don't disable the page if you go navigate // directly to it // @see http://api.drupal.org/api/function/hook_menu/6 for other types $items['user/%user_category/edit']['type'] = MENU_CALLBACK; // Only allow people with administer site configuration permissions to // access the user edit and user edit account tabs. $items['user/%user_category/edit']['access callback'] = 'user_access'; $items['user/%user_category/edit']['access arguments'] = array('administer site configuration'); $items['user/%user_category/edit/account']['access callback'] = 'user_access'; $items['user/%user_category/edit/account']['access arguments'] = array('administer site configuration'); // Completely disable the user edit tab, even if you go directly to it // This affects all users, including user 1. unset($items['user/%user_category/edit']); unset($items['user/%user_category/edit/account']); } 

Each menu item is registered in Drupal with an array of $items . After enabling this module, you need to rebuild the cache and the tabs must be changed.

+1
source

You can use the Tab Tamer module to edit the default Drupal link tabs that appear on user profile pages.

+1
source

All Articles