summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Phillips2010-04-16 16:22:14 (GMT)
committer Chad Phillips2010-04-16 16:22:14 (GMT)
commit87ed5c7d8eac9bcc4b58423483081625e69a52f5 (patch)
tree27df8d3c953742dbeaa5ab41c14d30d8a9e4df4c
parent4a75c27402e7a35372ddb0ccb1b3d0719b089f46 (diff)
#765994 by hunmonk: Non-authenticated role is hidden in user profile form even when 'Set password' is unchecked
-rwxr-xr-xlogintoboggan.module9
1 files changed, 6 insertions, 3 deletions
diff --git a/logintoboggan.module b/logintoboggan.module
index 1df409d..5b6f0d2 100755
--- a/logintoboggan.module
+++ b/logintoboggan.module
@@ -155,10 +155,11 @@ function logintoboggan_form_alter(&$form, $form_state, $form_id) {
$form['#validate'][] = 'logintoboggan_user_edit_validate';
$account = user_load(array('uid' => arg(1)));
$id = logintoboggan_validating_id();
+ $pre_auth = !variable_get('user_email_verification', TRUE) && $id != DRUPAL_AUTHENTICATED_RID;
$in_pre_auth_role = in_array($id, array_keys($account->roles));
// Messages are only necessary for user admins, and aren't necessary if
- // pre-auth role is authenticated user.
- if (user_access('administer users') && isset($form['account']['roles']) && $id != DRUPAL_AUTHENTICATED_RID) {
+ // there's no valid pre-auth role.
+ if (user_access('administer users') && isset($form['account']['roles']) && $pre_auth) {
// User is still in the pre-auth role, so let the admin know.
if ($in_pre_auth_role) {
if ((variable_get('user_register', 1) == 2)) {
@@ -272,9 +273,11 @@ function logintoboggan_form_alter(&$form, $form_state, $form_id) {
// Unset the ability to add the pre-auth role in the user admin interface.
case 'user_admin_account':
+ // Test here for a valid pre-auth -- we only remove this role if one exists.
$id = logintoboggan_validating_id();
+ $pre_auth = !variable_get('user_email_verification', TRUE) && $id != DRUPAL_AUTHENTICATED_RID;
$add = t('Add a role to the selected users');
- if ($id != DRUPAL_AUTHENTICATED_RID && isset($form['options']['operation']['#options'][$add]["add_role-$id"])) {
+ if ($pre_auth && isset($form['options']['operation']['#options'][$add]["add_role-$id"])) {
unset($form['options']['operation']['#options'][$add]["add_role-$id"]);
}
break;