Don't count the system user on the administration page

This commit is contained in:
Michael 2021-12-24 12:36:44 +00:00
parent 54390bf19f
commit 7488a793a8
3 changed files with 5 additions and 4 deletions

View file

@ -40,14 +40,15 @@ abstract class BaseUsers extends BaseAdmin
*/ */
protected static function getTabsHTML(string $selectedTab) protected static function getTabsHTML(string $selectedTab)
{ {
$active = DBA::count('user', ['blocked' => false, 'verified' => true, 'account_removed' => false]); $all = DBA::count('user', ["`uid` != ?", 0]);
$active = DBA::count('user', ["NOT `blocked` AND `verified` AND NOT `account_removed` AND `uid` != ?", 0]);
$pending = Register::getPendingCount(); $pending = Register::getPendingCount();
$blocked = DBA::count('user', ['blocked' => true, 'verified' => true, 'account_removed' => false]); $blocked = DBA::count('user', ['blocked' => true, 'verified' => true, 'account_removed' => false]);
$deleted = DBA::count('user', ['account_removed' => true]); $deleted = DBA::count('user', ['account_removed' => true]);
$tabs = [ $tabs = [
[ [
'label' => DI::l10n()->t('All') . ' (' . DBA::count('user') . ')', 'label' => DI::l10n()->t('All') . ' (' . $all . ')',
'url' => 'admin/users', 'url' => 'admin/users',
'sel' => !$selectedTab || $selectedTab == 'all' ? 'active' : '', 'sel' => !$selectedTab || $selectedTab == 'all' ? 'active' : '',
'title' => DI::l10n()->t('List of all users'), 'title' => DI::l10n()->t('List of all users'),

View file

@ -128,7 +128,7 @@ class Active extends BaseUsers
$th_users = array_map(null, [DI::l10n()->t('Name'), DI::l10n()->t('Email'), DI::l10n()->t('Register date'), DI::l10n()->t('Last login'), DI::l10n()->t('Last public item'), DI::l10n()->t('Type')], $valid_orders); $th_users = array_map(null, [DI::l10n()->t('Name'), DI::l10n()->t('Email'), DI::l10n()->t('Register date'), DI::l10n()->t('Last login'), DI::l10n()->t('Last public item'), DI::l10n()->t('Type')], $valid_orders);
$count = DBA::count('user', ['blocked' => false, 'account_removed' => false]); $count = DBA::count('user', ["NOT `blocked` AND `verified` AND NOT `account_removed` AND `uid` != ?", 0]);
$t = Renderer::getMarkupTemplate('admin/users/active.tpl'); $t = Renderer::getMarkupTemplate('admin/users/active.tpl');
return self::getTabsHTML('active') . Renderer::replaceMacros($t, [ return self::getTabsHTML('active') . Renderer::replaceMacros($t, [

View file

@ -141,7 +141,7 @@ class Index extends BaseUsers
$th_users = array_map(null, [DI::l10n()->t('Name'), DI::l10n()->t('Email'), DI::l10n()->t('Register date'), DI::l10n()->t('Last login'), DI::l10n()->t('Last public item'), DI::l10n()->t('Type')], $valid_orders); $th_users = array_map(null, [DI::l10n()->t('Name'), DI::l10n()->t('Email'), DI::l10n()->t('Register date'), DI::l10n()->t('Last login'), DI::l10n()->t('Last public item'), DI::l10n()->t('Type')], $valid_orders);
$count = DBA::count('user'); $count = DBA::count('user', ["`uid` != ?", 0]);
$t = Renderer::getMarkupTemplate('admin/users/index.tpl'); $t = Renderer::getMarkupTemplate('admin/users/index.tpl');
return self::getTabsHTML('all') . Renderer::replaceMacros($t, [ return self::getTabsHTML('all') . Renderer::replaceMacros($t, [