rendered paste body$admin_access = user_access('administer users');
$view_access = user_access('access user profiles');
if ($may_cache) {
$items[] = array('path' => 'user', 'title' => t('user account'),
'callback' => 'user_login', 'access' => TRUE, 'type' => MENU_CALLBACK);
// Your personal page
if ($user->uid) {
$items[] = array('path' => 'user/'. $user->uid, 'title' => t('my account'),
'callback' => 'user_view', 'callback arguments' => array($user->uid), 'access' => TRUE,
'type' => MENU_DYNAMIC_ITEM);
}
}
$items[] = array('path' => 'user/'. arg(1) .'/edit', 'title' => t('edit'),
'callback' => 'user_edit', 'access' => $admin_access || $user->uid == arg(1),
'type' => MENU_LOCAL_TASK);
if (arg(0) == 'user' && arg(2) == 'edit' && is_numeric(arg(1)) && arg(1) > 0) {
$account = user_load(array('uid' => arg(1)));
$categories = _user_categories($account);
if ($categories && count($categories) > 1) {
foreach ($categories as $key => $category) {
switch ($category['name']) {
case 'resort':
if (in_array('Industry | Resort', $account->roles)) {
$category['access'] = true;
} else {
$category['access'] = false;
}
break;
case 'profile': case 'personal':
if (in_array('Industry | Resort', $account->roles)) {
$category['access'] = false;
} else {
$category['access'] = true;
}
break;
default:
$category['access'] = ($admin_access || $user->uid == arg(1));
break;
}
$items[] = array(
'path' => 'user/'. arg(1) .'/edit/'. $category['name'],
'title' => $category['title'],
'type' => $category['name'] == 'account' ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
'weight' => $category['weight'],
'access' => $category['access']
);
}
static $done;
if (!$done) {
drupal_set_message('<pre>'. print_r($GLOBALS['_menu'], true) .'</pre>');
$done = true;
}
}
}