<?php
/* $Id: rolesignup.module,v 1.2.4.1 2007/01/20 21:49:48 sym Exp $ */
/********************************************************************
* Drupal Hooks
********************************************************************/
/**
* Implementation of module_enable()
*/
function rolesignup_enable() {
}
/**
* Implementation of module_disable()
*/
function rolesignup_disable() {
}
/**
* Implementation of hook_menu()
*/
function rolesignup_menu() {
'user/register/role/%' =>
array(
'page callback' => 'role_register_page',
'page arguments' =>
array(3),
'title' =>
t('Register'),
)
);
}
/**
* Implementation of hook_perm()
*/
function rolesignup_perm() {
return array('register for role');
}
function role_register_page($string = NULL) {
}
/**
* Implementation of hook_user()
*/
function rolesignup_user($op, &$edit, &$account, $category = NULL) {
switch ($op) {
case 'insert':
if ($roles[$_SESSION['role']]) {
$edit["roles"] =
array($_SESSION['role'] =>
$roles[$_SESSION['role']]);
} else {
$edit["roles"][$_SESSION['role']] = $roles[$_SESSION['role']];
}
}
break;
case 'register':
if(!$category || $category == "account") {
if (!$_SESSION['role']) {
}
$rolename = $roles[$_SESSION['role']];
$form["#prefix"] =
"<p class='messages role_select'>You are registering for the '".
ucwords(strtolower($rolename)).
"' Role.<br/></p>";
"#type" => "submit"
,
"#submit" =>
array("rolesignup_goto_role_selection")
,"#value" => "Change Role"
);
return $form;
}
break;
}
}
function rolesignup_goto_role_selection($form, &$form_state) {
$url = 'user/register/role/'.$_SESSION['role'];
unset($_SESSION['role']);
}
function rolelist_form($form_state = NULL, $roles, $string) {
$rid = $string;
} else {
$rid = $rids[0];
}
"#type" => "select"
,"#options" => $roles
,"#default_value" => $rid
,"#description" => "roles define the behaviour of your account."
,"#required" => TRUE
);
"#type" => "submit"
,"#value" => "Next"
);
return $form;
}
function rolelist_form_submit($form, &$form_state) {
$_SESSION['role'] = $form_state["values"]["role"];
}