Craft 3 beta - User group total I have tried to find the new way get the total in a user group in php (plugin), but not having much luck... Please help
Assume it starts with Craft::$app->users ?
Use the ActiveRecord from Yii2

$userGroupId = 1 // insert your usergroup Id here
$users = User::find()-&gt;groupId($userGroupId)-&gt;all();


Or via handle

$userGroup = Craft::$app-&gt;userGroups-&gt;getGroupByHandle('handle');
$users = User::find()-&gt;group($userGroup)-&gt;all();


If you mean the number of users in a group with total you just have to do count() instead of all()

To get the users of each group you can do

foreach(Craft::$app-&gt;userGroups-&gt;getAllGroups() as $userGroup){
    $users = User::find()-&gt;group($userGroup)-&gt;all();
}