summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/user/user.module10
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/user/user.module b/modules/user/user.module
index d34259531..4c458d765 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -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