Skip to content
This repository
Browse code

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 Costello authored March 20, 2011

Showing 1 changed file with 32 additions and 0 deletions. Show diff stats Hide diff stats

  1. 32  engine/lib/admin.php
32  engine/lib/admin.php
@@ -8,6 +8,38 @@
8 8
  */
9 9
 
10 10
 /**
  11
+ * Get the admin users 
  12
+ *
  13
+ * @param array $options Options array, @see elgg_get_entities() for parameters
  14
+ *
  15
+ * @return mixed Array of admin users or false on failure. If a count, returns int.
  16
+ * @since 1.8.0
  17
+ */
  18
+function elgg_get_admins(array $options = array()) {
  19
+	global $CONFIG;
  20
+
  21
+	if (isset($options['joins'])) {
  22
+		if (!is_array($options['joins'])) {
  23
+			$options['joins'] = array($options['joins']);
  24
+		}
  25
+		$options['joins'][] = "join {$CONFIG->dbprefix}users_entity u on e.guid=u.guid";
  26
+	} else {
  27
+		$options['joins'] = array("join {$CONFIG->dbprefix}users_entity u on e.guid=u.guid");
  28
+	}
  29
+
  30
+	if (isset($options['wheres'])) {
  31
+		if (!is_array($options['wheres'])) {
  32
+			$options['wheres'] = array($options['wheres']);
  33
+		}
  34
+		$options['wheres'][] = "u.admin = 'yes'";
  35
+	} else {
  36
+		$options['wheres'][] = "u.admin = 'yes'";
  37
+	}
  38
+
  39
+	return elgg_get_entities($options);
  40
+}
  41
+
  42
+/**
11 43
  * Write a persistent message to the admin view.
12 44
  * Useful to alert the admin to take a certain action.
13 45
  * The id is a unique ID that can be cleared once the admin

0 notes on commit 0712578

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