]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #4168 ignoring access when saving an admin notice
authorCash Costello <cash.costello@gmail.com>
Sun, 1 Jan 2012 20:29:39 +0000 (15:29 -0500)
committerCash Costello <cash.costello@gmail.com>
Sun, 1 Jan 2012 20:29:39 +0000 (15:29 -0500)
engine/lib/admin.php

index a191d740bb005f9217a1c3c18aa0a98a31f1c21d..1f085eee4c8db33cc3f2e2ab67806ac925ff2366 100644 (file)
@@ -79,6 +79,10 @@ function elgg_add_admin_notice($id, $message) {
                if (elgg_admin_notice_exists($id)) {
                        return false;
                }
+
+               // need to handle when no one is logged in
+               $old_ia = elgg_set_ignore_access(true);
+
                $admin_notice = new ElggObject();
                $admin_notice->subtype = 'admin_notice';
                // admins can see ACCESS_PRIVATE but no one else can.
@@ -86,13 +90,16 @@ function elgg_add_admin_notice($id, $message) {
                $admin_notice->admin_notice_id = $id;
                $admin_notice->description = $message;
 
-               return $admin_notice->save();
+               $result = $admin_notice->save();
+
+               elgg_set_ignore_access($old_ia);
+
+               return (bool)$result;
        }
 
-       return FALSE;
+       return false;
 }
 
-
 /**
  * Remove an admin notice by ID.
  *