Commit 69da830c authored by Gábor Hojtsy's avatar Gábor Hojtsy

#171117 by JirkaRybka: set access time for admin created or edited accounts so...

#171117 by JirkaRybka: set access time for admin created or edited accounts so they are exempt from the spam protection we have for accounts never logged in
parent bfd7c0f1
......@@ -203,6 +203,11 @@ function user_save($account, $array = array(), $category = 'account') {
user_module_invoke('update', $array, $account, $category);
$query = '';
$data = unserialize(db_result(db_query('SELECT data FROM {users} WHERE uid = %d', $account->uid)));
// Consider users edited by an administrator as logged in, if they haven't
// already, so anonymous users can view the profile (if allowed).
if (empty($array['access']) && empty($account->access) && user_access('administer users')) {
$array['access'] = time();
}
foreach ($array as $key => $value) {
if ($key == 'pass' && !empty($value)) {
$query .= "$key = '%s', ";
......@@ -269,6 +274,11 @@ function user_save($account, $array = array(), $category = 'account') {
if (!isset($array['created'])) { // Allow 'created' to be set by the caller
$array['created'] = time();
}
// Consider users created by an administrator as already logged in, so
// anonymous users can view the profile (if allowed).
if (empty($array['access']) && user_access('administer users')) {
$array['access'] = time();
}
// Note, we wait with saving the data column to prevent module-handled
// fields from being saved there. We cannot invoke hook_user('insert') here
......
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