function social_user_export_groups_count in Open Social 8
Same name and namespace in other branches
- 8.2 modules/social_features/social_user_export/social_user_export.module \social_user_export_groups_count()
Returns quantity of groups created by specific user.
Parameters
\Drupal\user\UserInterface $account: The account to get the data for.
Return value
int Quantity of groups created by the account.
1 call to social_user_export_groups_count()
- ExportUser::exportUserOperation in modules/
social_features/ social_user_export/ src/ ExportUser.php - Callback of one operation.
File
- modules/
social_features/ social_user_export/ social_user_export.module, line 181 - The Social User Export module.
Code
function social_user_export_groups_count(UserInterface $account) {
$query = \Drupal::database()
->select('groups', 'g');
$query
->join('groups_field_data', 'gfd', 'gfd.id = g.id');
$query
->condition('gfd.uid', $account
->id());
return (int) $query
->countQuery()
->execute()
->fetchField();
}