function autoassignrole_menu_alter in Auto Assign Role 6
Same name and namespace in other branches
- 6.2 autoassignrole.module \autoassignrole_menu_alter()
Implementation of hook_menu_alter()
Redirect the default user register page to a path that has been designated as the replacement registration path.
File
- ./
autoassignrole.module, line 666 - The main autoassignrole.module file
Code
function autoassignrole_menu_alter(&$items) {
$row = db_fetch_object(db_query("SELECT rid, path, display, title, weight, menu, registration FROM {autoassignrole_page} WHERE registration = 1"));
if (isset($row->registration)) {
$path = $row->path;
}
else {
$row = db_fetch_object(db_query("SELECT arid, value FROM {autoassignrole} WHERE arid = '%s'", 'node_user_register'));
if (!empty($row->value)) {
$path = 'node/' . $row->value;
}
}
if (isset($path)) {
$items['user/register']['page arguments'] = array(
$path,
);
$items['user/register']['page callback'] = 'drupal_goto';
$items['user/register']['type'] = MENU_LOCAL_TASK;
}
}