function advuser_user in Advanced User 6.3
Same name and namespace in other branches
- 5.2 advuser.module \advuser_user()
- 5 advuser.module \advuser_user()
- 6.2 advuser.module \advuser_user()
hook_user implementation
On 'form' (indicates user edit form) save the account data in a static cache. On 'insert' call the registration notification function. On 'after_update' call the profile update notification function.
Related topics
File
- ./
advuser.module, line 400 - Advanced user module allows you to select users based on an advanced set of filtering and apply actions to block, unblock, delete or email the selected users.
Code
function advuser_user($type, &$edit, &$account, $category = NULL) {
static $account_before_edit;
static $insert = FALSE;
$return = NULL;
switch ($type) {
case 'load':
if ($insert) {
// Now the record exists and we can update it.
if (variable_get('advuser_set_never_access', FALSE)) {
if ($account->login == 0) {
$account->access = 0;
_advuser_update_never_accessed($account->uid);
}
}
$insert = FALSE;
}
// continue into the 'form' case.
case 'form':
// Need to remove the form identification data!
// Why does it need to be stored in the data serialized array?!
$account_before_edit = $account;
$account_before_edit->form_build_id = '';
if (is_string($account->data)) {
$account_before_edit->data = unserialize($account->data);
}
unset($account_before_edit->data['form_build_id']);
break;
case 'insert':
// Flag that we've seen the insert operation. The insert hasn't occurred
// but is being readied for insert.
$insert = TRUE;
// Notify those that need to be.
$return = _advuser_receive_notification_by_role('insert', $account);
break;
case 'after_update':
// Need to remove the form identification data!
// Why does it need to be stored in the data serialized array?!
$account_after_edit = $account;
$account_after_edit->form_build_id = '';
if (is_string($account_after_edit->data)) {
$account_after_edit->data = unserialize($account->data);
}
unset($account_after_edit->data['form_build_id']);
if ($account_after_edit->login == 0) {
if (variable_get('advuser_reset_never_access', FALSE)) {
$account_after_edit->access = 0;
_advuser_update_never_accessed($account_after_edit->uid);
}
}
if ($account_after_edit != $account_before_edit) {
$return = _advuser_receive_notification_by_role('update', $account);
}
break;
}
return $return;
}