You are here

public function MembershipManager::isMemberPending in Organic groups 8

Returns whether a user belongs to a group with a pending status.

Parameters

\Drupal\Core\Entity\EntityInterface $group: The group entity.

int $user_id: The ID of the user.

Return value

bool True if the membership is pending.

Overrides MembershipManagerInterface::isMemberPending

See also

\Drupal\og\Og::isMember

File

src/MembershipManager.php, line 429

Class

MembershipManager
Service for managing memberships and group content.

Namespace

Drupal\og

Code

public function isMemberPending(EntityInterface $group, $user_id) {
  if ($user_id instanceof AccountInterface) {
    trigger_error('Passing an account object is deprecated in og:8.1.0-alpha4 and is removed from og:8.1.0-beta1. Instead pass the user ID as an integer value. See https://github.com/Gizra/og/issues/542', E_USER_DEPRECATED);
    $user_id = $user_id
      ->id();
  }
  return $this
    ->isMember($group, $user_id, [
    OgMembershipInterface::STATE_PENDING,
  ]);
}