<?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');
}
/**
* Implementation of hook_form_alter()
*/
//function rolesignup_form_alter(&$form, $form_state, $form_id) {
// if ($form_id == "user_register") {
// global $user;
// if (!user_access('administer users') && !$_SESSION['role']) {
// drupal_goto('user/register/role', drupal_get_destination());
// } else {
// $form['role'] = array(
// '#type' => 'value',
// '#value' => $_SESSION['role'],
// );
// }
// $form['rolelink'] = array(
// '#value' => theme('select_role'),
// '#weight' => -11,
// );
// }
//}
function role_register_page($string = NULL) {
}
/**
* Implementation of hook_user()
*/
function rolesignup_user($op, &$edit, &$account, $category = NULL) {
switch ($op) {
case 'insert':
db_query('INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)',
$account->
uid,
$_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']);
}
/**********************************************************************************/
/*
mysql> select * from web_watchdog\G
*************************** 1. row ***************************
wid: 2186
uid: 1
type: actions
message: One orphaned action (<em>comment_unpublish_action</em>) exists in the actions table. <a href="/click_to_call/?q=admin/build/actions/orphan">Remove orphaned actions</a>
variables: a:0:{}
severity: 5
link:
location: http://localhost/click_to_call/?q=admin/build/modules/list/confirm
referer: http://localhost/click_to_call/?q=admin/build/modules
hostname: 127.0.0.1
timestamp: 1201784818
*************************** 2. row ***************************
wid: 2187
uid: 1
type: user
message: Session closed for %name.
variables: a:1:{s:5:"%name";s:11:"clicktocall";}
severity: 5
link:
location: http://localhost/click_to_call/?q=logout
referer: http://localhost/click_to_call/?q=admin/build/modules
hostname: 127.0.0.1
timestamp: 1201784826
*************************** 3. row ***************************
wid: 2188
uid: 0
type: user
message: New user: %name (%email).
variables: a:2:{s:5:"%name";s:5:"dssdf";s:6:"%email";s:15:"asdfa@sdfsd.csd";}
severity: 5
link: <a href="/click_to_call/?q=user/17/edit">edit</a>
location: http://localhost/click_to_call/?q=user/register
referer: http://localhost/click_to_call/?q=user/register
hostname: 127.0.0.1
timestamp: 1201784843
3 rows in set (0.00 sec)
*/
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"];
}