public function MembershipManager::isMemberBlocked in Organic groups 8
Returns whether an entity belongs to a group with a blocked status.
Parameters
\Drupal\Core\Entity\EntityInterface $group: The group entity.
int $user_id: The ID of the user to test the membership for.
Return value
bool True if the membership is blocked.
Overrides MembershipManagerInterface::isMemberBlocked
See also
\Drupal\og\Og::isMember
File
- src/
MembershipManager.php, line 441
Class
- MembershipManager
- Service for managing memberships and group content.
Namespace
Drupal\ogCode
public function isMemberBlocked(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_BLOCKED,
]);
}