Reply to comment

Drupal CMS: Change user profile title & tab title

Since I needed some time to find out how to change the user profile tabs title and page title, I'd like to share that information with you.

Drupal 7:

The below snippet changes the titles to static values and removes the dynamic page title callback:

  1.  /**
  2.   * Implements hook_menu_alter  *
  3.   */
  4. function MYMODULE_menu_alter(&$items) {
  5.   // Overwrite the login form title:
  6.   $items['user']['title'] = 'Overview';
  7.   unset($items['user']['title callback']);
  9.   // Overwrite "View" user profile tab:
  10.   $items['user/%user/view']['title'] = 'Overview';
  11.   unset($items['user/%user/view']['title callback']);
  13.   // Override user profile page title:
  14.   $items['user/%user']['title'] = 'Customer account';
  15.   unset($items['user/%user']['title callback']);
  17.   // Override "Edit" user profile tab:
  18.   $items['user/%user/edit']['title'] = 'Settings';
  19.   unset($items['user/%user/edit']['title callback']);
  20. }

If you need a dynamic title, for example with the user name included, you would instead replace the title callback with your custom callback. Keep in mind that this may also mean you have to remove the source file for the page title callback in that case.

  1. $items['user/%user']['title callback'] = 'MYMODULE_user_page_title';
  2. unset($items['user/%user']['file']);

Drupal 8

For Drupal 8 you might use as simple solution or have a look at its implementation.


The content of this field is kept private and will not be shown publicly.

More information about formatting options