Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Refs #2892 added elgg_get_admins() function - this could eventually b…

…e a wrapper around elgg_get_users()

git-svn-id: http://code.elgg.org/elgg/trunk@8783 36083f99-b078-4883-b0ff-0f9b5a30f544
  • Loading branch information...
commit 07125786f7d6fbe1b394141a2cdd983af7092f12 1 parent 7c6ed46
@cash cash authored
Showing with 32 additions and 0 deletions.
  1. +32 −0 engine/lib/admin.php
View
32 engine/lib/admin.php
@@ -8,6 +8,38 @@
*/
/**
+ * Get the admin users
+ *
+ * @param array $options Options array, @see elgg_get_entities() for parameters
+ *
+ * @return mixed Array of admin users or false on failure. If a count, returns int.
+ * @since 1.8.0
+ */
+function elgg_get_admins(array $options = array()) {
+ global $CONFIG;
+
+ if (isset($options['joins'])) {
+ if (!is_array($options['joins'])) {
+ $options['joins'] = array($options['joins']);
+ }
+ $options['joins'][] = "join {$CONFIG->dbprefix}users_entity u on e.guid=u.guid";
+ } else {
+ $options['joins'] = array("join {$CONFIG->dbprefix}users_entity u on e.guid=u.guid");
+ }
+
+ if (isset($options['wheres'])) {
+ if (!is_array($options['wheres'])) {
+ $options['wheres'] = array($options['wheres']);
+ }
+ $options['wheres'][] = "u.admin = 'yes'";
+ } else {
+ $options['wheres'][] = "u.admin = 'yes'";
+ }
+
+ return elgg_get_entities($options);
+}
+
+/**
* 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

0 comments on commit 0712578

Please sign in to comment.
Something went wrong with that request. Please try again.