From: Evan Prodromou Date: Fri, 29 Jan 2010 20:15:23 +0000 (-0500) Subject: method to get the site owner X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=70a4f8c0e26bfdb76f595ce501c6e84a8011fea8;p=quix0rs-gnu-social.git method to get the site owner --- diff --git a/classes/User.php b/classes/User.php index 6ea975202d..b700496178 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; + } }