All pastes #102546 Raw Edit

Someone

public text v1 · immutable
#102546 ·published 2006-07-27 17:31 UTC
rendered paste body
function cnucustom_menu($may_cache) {
  global $user;
  $items = array();

  if ($may_cache) {
    $items[] = array('title'    => t('Map Drupal Users'),
                     'path'     => 'civicrm/map',
                     'access'   => user_access('access CiviCRM'),
                     'callback' => 'cnucustom_uf_matches',
    );
  }

  // we have to override the tabs on the user's page so that we can add
  // a new member splash page and make the 'view' say 'member profile'.
  if (arg(0) == 'user' && is_numeric(arg(1)) && arg(1) > 0) {
    $account = user_load(array('uid' => arg(1))); // check for blocked accounts.
    $view_access |= $user->uid == arg(1); // Always let a user view their own account.
    $view_access &= $account->status || $admin_access; // Only admins can view blocked accounts.

    $title = (arg(1) == $user->uid) ? t('my profile') : t('member profile');
    $items[] = array('path'     => 'user/'. arg(1) .'/view', 
                     'type'     => MENU_DEFAULT_LOCAL_TASK, 
                     'title'    => $title, // "my" or "member"
                     'access'   => $view_access, 
                     'weight'   => -10
    );
  }

  return $items;
}