Simplified code
This commit is contained in:
parent
2a243b747d
commit
a3ba0ccc93
1 changed files with 4 additions and 6 deletions
|
@ -194,15 +194,13 @@ class User
|
||||||
public static function getFirstAdmin(array $fields = [])
|
public static function getFirstAdmin(array $fields = [])
|
||||||
{
|
{
|
||||||
if (!empty(DI::config()->get('config', 'admin_nickname'))) {
|
if (!empty(DI::config()->get('config', 'admin_nickname'))) {
|
||||||
$administrator = self::getByNickname(DI::config()->get('config', 'admin_nickname'), $fields);
|
return self::getByNickname(DI::config()->get('config', 'admin_nickname'), $fields);
|
||||||
} elseif (!empty(DI::config()->get('config', 'admin_email'))) {
|
} elseif (!empty(DI::config()->get('config', 'admin_email'))) {
|
||||||
$adminList = explode(',', str_replace(' ', '', DI::config()->get('config', 'admin_email')));
|
$adminList = explode(',', str_replace(' ', '', DI::config()->get('config', 'admin_email')));
|
||||||
$administrator = self::getByEmail($adminList[0], $fields);
|
return self::getByEmail($adminList[0], $fields);
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
if (!empty($administrator)) {
|
|
||||||
return $administrator;
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue