aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/access.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/access.php')
-rw-r--r--engine/lib/access.php19
1 files changed, 13 insertions, 6 deletions
diff --git a/engine/lib/access.php b/engine/lib/access.php
index 5ccf238c8..7edb2d012 100644
--- a/engine/lib/access.php
+++ b/engine/lib/access.php
@@ -225,14 +225,21 @@ END;
if (!isset($owner)) {
$owner = get_loggedin_userid();
}
- if (!$owner) $owner = -1;
- $access = get_access_list($owner);
-
- // do NOT use $is_admin global user here, since that only checks against
+ // do NOT use $is_admin global here, since that only checks against
// the current logged in user.
+ // Can't use metadata here because because of recursion.
+ // (get_entity, get_*() calls this function.)
+ if (!$owner) {
+ $owner = -1;
+ $admin = false;
+ } else {
+ $admin = is_admin_user($owner);
+ }
+
+ $access = get_access_list($owner);
- if ($owner->admin == 'yes') {
+ if ($admin) {
$sql = " (1 = 1) ";
} else if ($owner != -1) {
$friends_bit = $table_prefix.'access_id = '.ACCESS_FRIENDS.' AND ';
@@ -729,4 +736,4 @@ END;
// This function will let us know when 'init' has finished
register_elgg_event_handler('init','system','access_init',9999);
-?> \ No newline at end of file
+?>