]> git.mxchange.org Git - friendica.git/commitdiff
Improved functionality to fetch the admin user
authorMichael <heluecht@pirati.ca>
Wed, 29 Jul 2020 14:55:55 +0000 (14:55 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 29 Jul 2020 14:55:55 +0000 (14:55 +0000)
src/Model/User.php

index 0317edf9bf1c10159a53a72849318cd4c056b534..7b88aac1897dd93d6066f73ddedd67ea106bd267 100644 (file)
@@ -193,17 +193,14 @@ class User
         */
        public static function getFirstAdmin(array $fields = [])
        {
-               $condition = [];
                if (!empty(DI::config()->get('config', 'admin_nickname'))) {
-                       $condition['nickname'] = DI::config()->get('config', 'admin_nickname');
-               }
-               if (!empty(DI::config()->get('config', 'admin_email'))) {
+                       $administrator = self::getByNickname(DI::config()->get('config', 'admin_nickname'), $fields);
+               } elseif (!empty(DI::config()->get('config', 'admin_email'))) {
                        $adminList = explode(',', str_replace(' ', '', DI::config()->get('config', 'admin_email')));
-                       $condition['email'] = $adminList[0];
                        $administrator = self::getByEmail($adminList[0], $fields);
-                       if (!empty($administrator)) {
-                               return $administrator;
-                       }
+               }
+               if (!empty($administrator)) {
+                       return $administrator;
                }
                return [];
        }