diff options
-rw-r--r-- | engine/lib/admin.php | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/engine/lib/admin.php b/engine/lib/admin.php index 974f6b35d..abf3dad01 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -68,6 +68,53 @@ }
}
+ } + + /** + * Write a persistent message to the administrator's notification window. + * + * Currently this writes a message to the admin store, we may want to come up with another way at some point. + * + * @param string $subject Subject of the message + * @param string $message Body of the message + */ + function send_admin_message($subject, $message) + { + $subject = sanitise_string($subject); + $message = sanitise_string($message); + + if (($subject) && ($message)) + { + $admin_message = new ElggObject(); + $admin_message->subtype = 'admin_message'; + $admin_message->access_id = 2; + $admin_message->title = $subject; + $admin_message->description = $message; + + return $admin_message->save(); + } + + return false; + } + + /** + * List all admin messages. + * + * @param int $limit Limit + */ + function list_admin_messages($limit = 10) + { + return list_entities('object','admin_message',0,$limit); + } + + /** + * Remove an admin message. + * + * @param int $guid The + */ + function clear_admin_message($guid) + { + return delete_entity($guid); }
/// Register init function |