diff options
author | Evan Prodromou <evan@status.net> | 2010-01-29 15:15:23 -0500 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-01-29 15:15:23 -0500 |
commit | 70a4f8c0e26bfdb76f595ce501c6e84a8011fea8 (patch) | |
tree | f8a222c161e82f32355b29fa5c6a85026663b747 /classes/User.php | |
parent | d437b76ed1a7ba3c39f0d3cb8bef15e19c1c184f (diff) |
method to get the site owner
Diffstat (limited to 'classes/User.php')
-rw-r--r-- | classes/User.php | 26 |
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; + } } |