protected function VisitorsBlock::_showRegisteredUsersCount in Visitors 8.2
Display registered users count to visitors block.
1 call to VisitorsBlock::_showRegisteredUsersCount()
- VisitorsBlock::build in src/
Plugin/ Block/ VisitorsBlock.php - Builds and returns the renderable array for this block plugin.
File
- src/
Plugin/ Block/ VisitorsBlock.php, line 84 - Contains \Drupal\visitors\Plugin\Block\VisitorsBlock.
Class
- VisitorsBlock
- Provides a 'Visitors' block.
Namespace
Drupal\visitors\Plugin\BlockCode
protected function _showRegisteredUsersCount() {
if ($this->config
->get('show_registered_users_count')) {
$query = \Drupal::database()
->select('users');
$query
->addExpression('COUNT(*)');
$query
->condition('uid', '0', '>');
$registered_users_count = $query
->execute()
->fetchField();
$this->items[] = t('Registered Users: %registered_users_count', array(
'%registered_users_count' => $registered_users_count,
));
}
}