You are here

function realname_menu_alter in Real Name 6

Same name and namespace in other branches
  1. 7 realname.module \realname_menu_alter()

Implements hook_menu_alter().

File

./realname.module, line 148

Code

function realname_menu_alter(&$callbacks) {
  $callbacks['user/%user_uid_optional']['title callback'] = 'realname_user_page_title';

  // Adjust menu page callbacks to the real name alternatives.
  foreach ($callbacks as $path => $callback) {
    if (isset($callback['page callback'])) {
      switch ($callback['page callback']) {
        case 'user_view':

          // Skip if the Page manager module is installed, which needs to
          // override
          if ($path == 'user/%user_uid_optional' && module_exists('page_manager') && !variable_get('page_manager_user_view_disabled', TRUE)) {
            continue;
          }
        case 'user_edit':
        case 'tracker_page':
        case 'statistics_user_tracker':
        case 'content_profile_page_edit':
          $callbacks[$path]['page callback'] = 'realname_' . $callback['page callback'];
          break;
        case 'contact_user_page':
          $callbacks[$path]['page callback'] = 'realname_contact_user';
          break;
        case 'blog_page_user':
          $callbacks[$path]['page callback'] = 'realname_blog_page';
          break;
      }
    }
  }

  // Remove the core user_search, if requested.
  if (variable_get('realname_user_disable', FALSE) && isset($callbacks['search/user/%menu_tail'])) {
    unset($callbacks['search/user/%menu_tail']);
  }
}