function _logintoboggan_user_roles_alter in LoginToboggan 5
Same name and namespace in other branches
- 6 logintoboggan.module \_logintoboggan_user_roles_alter()
- 7 logintoboggan.module \_logintoboggan_user_roles_alter()
Alter user roles for loaded user account.
If user is not an anonymous user, and the user has the pre-auth role, and the pre-auth role isn't also the auth role, then unset the auth role for this user--they haven't validated yet.
This alteration is required because sess_read() and user_load() automatically set the authenticated user role for all non-anonymous users (see http://drupal.org/node/92361).
Parameters
&$account: User account to have roles adjusted.
2 calls to _logintoboggan_user_roles_alter()
- logintoboggan_init in ./
logintoboggan.module - Implementation of hook_init()
- logintoboggan_user in ./
logintoboggan.module - Implementation of hook_user().
File
- ./
logintoboggan.module, line 470 - Logintoboggan Module
Code
function _logintoboggan_user_roles_alter(&$account) {
$id = logintoboggan_validating_id();
$in_pre_auth_role = in_array($id, array_keys($account->roles));
if ($account->uid && $in_pre_auth_role) {
if ($id != DRUPAL_AUTHENTICATED_RID) {
unset($account->roles[DRUPAL_AUTHENTICATED_RID]);
}
}
}