aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-20 20:06:11 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-20 20:06:11 +0000
commit07125786f7d6fbe1b394141a2cdd983af7092f12 (patch)
treef52d03c41df845cbb73868eb4312cfdb4f2d857c /engine
parent7c6ed461cf474739c5634a9fe050421c56a822bc (diff)
downloadelgg-07125786f7d6fbe1b394141a2cdd983af7092f12.tar.gz
elgg-07125786f7d6fbe1b394141a2cdd983af7092f12.tar.bz2
Refs #2892 added elgg_get_admins() function - this could eventually be a wrapper around elgg_get_users()
git-svn-id: http://code.elgg.org/elgg/trunk@8783 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/admin.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/engine/lib/admin.php b/engine/lib/admin.php
index efb1a4581..71bf8fe12 100644
--- a/engine/lib/admin.php
+++ b/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