Commit 1b77c0f3 authored by Alan D.'s avatar Alan D.

Role back to the state of the module without the option to assign roles using...

Role back to the state of the module without the option to assign roles using role keys when editting the users account. This will serve as a stable release, and the other changes will be readded to dev.
parent 1f3b0218
......@@ -53,12 +53,6 @@ function rolekey_admin_settings() {
'#default_value' => variable_get('rolekey_show_rolekey_info', 0),
'#description' => t('This option toogles the users "member" summary field in the "My account" area.'),
);
$form['user']['rolekey_show_rolekey_on_edit_form'] = array(
'#type' => 'checkbox',
'#title' => t('Show role key on user edit form'),
'#default_value' => variable_get('rolekey_show_rolekey_on_edit_form', 0),
'#description' => t('This option toogles the role key in the edit "My account" area.'),
);
$form['#redirect'] = 'admin/user/rolekey';
return system_settings_form($form);
}
......@@ -99,20 +93,13 @@ function rolekey_help($section) {
*/
function rolekey_user($op, &$edit, &$account, $category = NULL) {
switch ($op) {
case 'form':
case 'register':
if ($type == 'register' || ($type == 'form' && $category == 'account' && variable_get('rolekey_show_rolekey_on_edit_form', 0))) {
return _rolekey_key_form_element();
}
break;
return _rolekey_key_form_element();
case 'validate':
_rolekey_key_form_element_validate($edit, $account, $category);
break;
case 'update':
case 'insert':
if ($type == 'insert' || ($type == 'form' && $category == 'account' && variable_get('rolekey_show_rolekey_on_edit_form', 0))) {
return _rolekey_key_form_element();
}
_rolekey_key_form_element_submit($edit, $account, $category);
break;
case 'view':
if(variable_get('rolekey_show_rolekey_info', 0)) {
......@@ -122,10 +109,10 @@ function rolekey_user($op, &$edit, &$account, $category = NULL) {
);
return array(t('History') => $items);
}
break;
}
}
/**
* Private function to show membership details
*/
......@@ -229,13 +216,6 @@ function _rolekey_key_form_element_validate($edit, $account, $category) {
* Submission callback for _rolekey_key_form_element
*/
function _rolekey_key_form_element_submit(&$edit, $account, $category) {
if (variable_get('rolekey_show_rolekey_on_edit_form', 0) && !isset($edit['roles'])){
$result = db_query('SELECT r.rid, r.name FROM {role} r INNER JOIN {users_roles} ur ON ur.rid = r.rid WHERE ur.uid = %d', $account->uid);
while ($role = db_fetch_object($result)) {
$edit['roles'][$role->rid] = $role->rid;
}
}
$type = variable_get('rolekey_selection_type', 'textfield');
if (array_key_exists('rolekeycode', $edit) && $type != 'none') {
if ($type == 'textfield') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment