function autoassignrole_menu in Auto Assign Role 6.2
Same name and namespace in other branches
- 5.2 autoassignrole.module \autoassignrole_menu()
- 5 autoassignrole.module \autoassignrole_menu()
- 6 autoassignrole.module \autoassignrole_menu()
- 7.2 autoassignrole.module \autoassignrole_menu()
- 7 autoassignrole.module \autoassignrole_menu()
Implementation of hook_menu().
Return value
array
File
- ./
autoassignrole.module, line 17 - The main autoassignrole.module file
Code
function autoassignrole_menu() {
$items = array();
$items['admin/user/autoassignrole/autocomplete/node'] = array(
'title' => 'Node autocomplete',
'page callback' => 'autoassignrole_autocomplete_node',
'access callback' => 'user_access',
'access arguments' => array(
'administer autoassignrole',
),
'type' => MENU_CALLBACK,
'file' => 'autoassignrole-admin.inc',
);
$items['admin/user/autoassignrole'] = array(
'title' => t('Auto assign role'),
'description' => t('Designate a role to assign all new users to.'),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'autoassignrole_admin_form',
),
'access arguments' => array(
'administer autoassignrole',
),
'type' => MENU_NORMAL_ITEM,
'file' => 'autoassignrole-admin.inc',
);
// path based role assignments that are listed as a menu item
$result = db_query("SELECT rid, path, display, title, weight, menu FROM {autoassignrole_page}");
while ($r = db_fetch_object($result)) {
switch ($r->display) {
case 0:
$items[$r->path] = array(
'title' => check_plain($r->title),
'page arguments' => array(
$r->rid,
),
'page callback' => 'autoassignrole_path',
'access callback' => '_autoassignrole_path_access',
'file' => 'autoassignrole-path.inc',
'weight' => $r->weight,
'type' => MENU_NORMAL_ITEM,
'menu_name' => $r->menu,
);
$items[$r->path . '/register'] = array(
'title' => 'Create new account',
'page arguments' => array(
$r->rid,
),
'page callback' => 'autoassignrole_path',
'access callback' => '_autoassignrole_path_access',
'file' => 'autoassignrole-path.inc',
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items[$r->path . '/login'] = array(
'title' => 'Log in',
'access callback' => 'user_is_anonymous',
'type' => MENU_LOCAL_TASK,
'page callback' => '_autoassignrole_user_login',
'file' => 'autoassignrole-path.inc',
);
$items[$r->path . '/password'] = array(
'title' => 'Request new password',
'access callback' => 'user_is_anonymous',
'type' => MENU_LOCAL_TASK,
'page callback' => '_autoassignrole_user_password',
'file' => 'autoassignrole-path.inc',
);
break;
// tabs on user registration pages
case 1:
$items['user/' . $r->path] = array(
'title' => check_plain($r->title),
'page arguments' => array(
$r->rid,
),
'page callback' => 'autoassignrole_path',
'access callback' => '_autoassignrole_path_access',
'file' => 'autoassignrole-path.inc',
'type' => MENU_LOCAL_TASK,
'weight' => $r->weight,
);
break;
// no menu items
case 2:
$items[$r->path] = array(
'title' => check_plain($r->title),
'page arguments' => array(
$r->rid,
),
'page callback' => 'autoassignrole_path',
'access callback' => '_autoassignrole_path_access',
'file' => 'autoassignrole-path.inc',
'weight' => $r->weight,
'type' => MENU_CALLBACK,
);
$items[$r->path . '/register'] = array(
'title' => 'Create new account',
'page arguments' => array(
$r->rid,
),
'page callback' => 'autoassignrole_path',
'access callback' => '_autoassignrole_path_access',
'file' => 'autoassignrole-path.inc',
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items[$r->path . '/login'] = array(
'title' => 'Log in',
'access callback' => 'user_is_anonymous',
'type' => MENU_LOCAL_TASK,
'page callback' => '_autoassignrole_user_login',
'file' => 'autoassignrole-path.inc',
);
$items[$r->path . '/password'] = array(
'title' => 'Request new password',
'access callback' => 'user_is_anonymous',
'type' => MENU_LOCAL_TASK,
'page callback' => '_autoassignrole_user_password',
'file' => 'autoassignrole-path.inc',
);
break;
}
}
return $items;
}