summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-01-29 15:15:23 -0500
committerEvan Prodromou <evan@status.net>2010-01-29 15:15:23 -0500
commit70a4f8c0e26bfdb76f595ce501c6e84a8011fea8 (patch)
treef8a222c161e82f32355b29fa5c6a85026663b747 /classes
parentd437b76ed1a7ba3c39f0d3cb8bef15e19c1c184f (diff)
method to get the site owner
Diffstat (limited to 'classes')
-rw-r--r--classes/User.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/classes/User.php b/classes/User.php
index 6ea975202..b70049617 100644
--- a/classes/User.php
+++ b/classes/User.php
@@ -925,4 +925,30 @@ class User extends Memcached_DataObject
return $share;
}
}
+
+ static function siteOwner()
+ {
+ $owner = self::cacheGet('user:site_owner');
+
+ if ($owner === false) { // cache miss
+
+ $pr = new Profile_role();
+
+ $pr->role = Profile_role::OWNER;
+
+ $pr->orderBy('created');
+
+ $pr->limit(0, 1);
+
+ if ($pr->fetch($true)) {
+ $owner = User::staticGet('id', $pr->profile_id);
+ } else {
+ $owner = null;
+ }
+
+ self::cacheSet('user:site_owner', $owner);
+ }
+
+ return $owner;
+ }
}