You are here

function social_user_export_likes_count in Open Social 8.2

Returns the quantity of likes by a user.

Parameters

\Drupal\user\UserInterface $account: The account to get the data for.

Return value

int number of likes

1 call to social_user_export_likes_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 272
The Social User Export module.

Code

function social_user_export_likes_count(UserInterface $account) {
  $query = \Drupal::database()
    ->select('votingapi_vote', 'v');
  $query
    ->condition('v.user_id', $account
    ->id());
  return (int) $query
    ->countQuery()
    ->execute()
    ->fetchField();
}