function social_user_export_comments_count in Open Social 8.2
Same name and namespace in other branches
- 8 modules/social_features/social_user_export/social_user_export.module \social_user_export_comments_count()
Returns quantity of comments posted by specific user.
Parameters
\Drupal\user\UserInterface $account: The account to get the data for.
Return value
int Quantity of comments posted by the account.
1 call to social_user_export_comments_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 152 - The Social User Export module.
Code
function social_user_export_comments_count(UserInterface $account) {
$query = \Drupal::database()
->select('comment', 'c');
$query
->join('comment_field_data', 'cfd', 'cfd.cid = c.cid');
$query
->condition('cfd.uid', $account
->id());
return (int) $query
->countQuery()
->execute()
->fetchField();
}