/** * Write a persistent message to the admin view. * Useful to alert the admin to take a certain action. * The id is a unique ID that can be cleared once the admin * completes the action. * * eg: add_admin_notice('twitter_services_no_api', * 'Before your users can use Twitter services on this site, you must set up * the Twitter API key in the <a href="link">Twitter Services Settings</a>'); * * @param string $id A unique ID that your plugin can remember * @param string $message Body of the message * * @return bool * @since 1.8.0 */ function elgg_add_admin_notice($id, $message) { if ($id && $message) { if (elgg_admin_notice_exists($id)) { return false; } $admin_notice = new ElggObject(); $admin_notice->subtype = 'admin_notice'; // admins can see ACCESS_PRIVATE but no one else can. $admin_notice->access_id = ACCESS_PRIVATE; $admin_notice->admin_notice_id = $id; $admin_notice->description = $message; return $admin_notice->save(); } return FALSE; }
/** * Write a persistent message to the admin view. * Useful to alert the admin to take a certain action. * The id is a unique ID that can be cleared once the admin * completes the action. * * eg: add_admin_notice('twitter_services_no_api', * 'Before your users can use Twitter services on this site, you must set up * the Twitter API key in the <a href="link">Twitter Services Settings</a>'); * * @param string $id A unique ID that your plugin can remember * @param string $message Body of the message * * @return bool * @since 1.8.0 */ function elgg_add_admin_notice($id, $message) { if ($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. $admin_notice->access_id = ACCESS_PRIVATE; $admin_notice->admin_notice_id = $id; $admin_notice->description = $message; $result = $admin_notice->save(); elgg_set_ignore_access($old_ia); return (bool) $result; } return false; }
/** * Register a function as a web service method * * @deprecated 1.9 Enable the web services plugin and use elgg_ws_expose_function(). */ function expose_function($method, $function, array $parameters = NULL, $description = "", $call_method = "GET", $require_api_auth = false, $require_user_auth = false) { elgg_deprecated_notice("expose_function() deprecated for the function elgg_ws_expose_function() in web_services plugin", 1.9); if (!elgg_admin_notice_exists("elgg:ws:1.9")) { elgg_add_admin_notice("elgg:ws:1.9", "The web services are now a plugin in Elgg 1.9.\n\t\t\tYou must enable this plugin and update your web services to use elgg_ws_expose_function()."); } if (function_exists("elgg_ws_expose_function")) { return elgg_ws_expose_function($method, $function, $parameters, $description, $call_method, $require_api_auth, $require_user_auth); } }