You are here

function user_revision_count in User Revision 8

Returns a count of user revisions for a specific user.

Parameters

\Drupal\user\UserInterface: The user entity.

Return value

int User revision count.

2 calls to user_revision_count()
UserRevisionAccessCheck::checkAccess in src/Access/UserRevisionAccessCheck.php
Checks user revision access.
UserRevisionDeleteForm::submitForm in src/Form/UserRevisionDeleteForm.php
Form submission handler.

File

./user_revision.module, line 303
User Revision module.

Code

function user_revision_count(UserInterface $user) {
  $entity_type = \Drupal::service('entity_type.manager')
    ->getStorage('user')
    ->getEntityType();
  return \Drupal::database()
    ->query('SELECT COUNT(DISTINCT vid) FROM {' . $entity_type
    ->getRevisionTable() . '} WHERE uid=:uid', array(
    ':uid' => $user
      ->id(),
  ))
    ->fetchField();
}