You are here

public function RoleExpireApiService::getUserRoleExpiryTime in Role Expire 2.x

Same name and namespace in other branches
  1. 8 src/RoleExpireApiService.php \Drupal\role_expire\RoleExpireApiService::getUserRoleExpiryTime()

Get expiration time of a user role.

Parameters

int $uid: User ID.

string $rid: Role ID.

Return value

array Array with the expiration time.

1 call to RoleExpireApiService::getUserRoleExpiryTime()
RoleExpireApiService::processDefaultRoleDurationForUser in src/RoleExpireApiService.php
Sets the default role duration for the current user/role combination.

File

src/RoleExpireApiService.php, line 65

Class

RoleExpireApiService
Class RoleExpireApiService.

Namespace

Drupal\role_expire

Code

public function getUserRoleExpiryTime($uid, $rid) {
  $query = $this->database
    ->select('role_expire', 'n');
  $query
    ->fields('n', [
    'expiry_timestamp',
  ]);
  $query
    ->condition('n.uid', $uid, '=');
  $query
    ->condition('n.rid', $rid, '=');
  $result = $query
    ->execute()
    ->fetchField();
  return !empty($result) ? $result : '';
}