Commit ece2aab4 authored by Dries's avatar Dries

- Patch #47344 by gordon: fixed problem with anonymous user role not being properly initialized.

parent baa2ecc8
......@@ -67,7 +67,12 @@ function user_load($array = array()) {
$user = db_fetch_object($result);
$user = drupal_unpack($user);
$user->roles[DRUPAL_AUTHENTICATED_RID] = 'authenticated user';
if ($user->uid) {
$user->roles[DRUPAL_AUTHENTICATED_RID] = 'authenticated user';
}
else {
$user->roles[DRUPAL_ANONYMOUS_RID] = 'anonymous user';
}
$result = db_query('SELECT r.rid, r.name FROM {role} r INNER JOIN {users_roles} ur ON ur.rid = r.rid WHERE ur.uid = %d', $user->uid);
while ($role = db_fetch_object($result)) {
$user->roles[$role->rid] = $role->name;
......
......@@ -67,7 +67,12 @@ function user_load($array = array()) {
$user = db_fetch_object($result);
$user = drupal_unpack($user);
$user->roles[DRUPAL_AUTHENTICATED_RID] = 'authenticated user';
if ($user->uid) {
$user->roles[DRUPAL_AUTHENTICATED_RID] = 'authenticated user';
}
else {
$user->roles[DRUPAL_ANONYMOUS_RID] = 'anonymous user';
}
$result = db_query('SELECT r.rid, r.name FROM {role} r INNER JOIN {users_roles} ur ON ur.rid = r.rid WHERE ur.uid = %d', $user->uid);
while ($role = db_fetch_object($result)) {
$user->roles[$role->rid] = $role->name;
......
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