admin; if ($admin) { return true; } } } /** * 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 register_elgg_event_handler('init','system','admin_init'); // Register a plugin hook for permissions register_plugin_hook('permissions_check','all','admin_permissions'); ?>