public function Meeting::isMember in Opigno Moxtra 8
Same name and namespace in other branches
- 3.x src/Entity/Meeting.php \Drupal\opigno_moxtra\Entity\Meeting::isMember()
Checks if the user is a member of the live meeting or related training.
Parameters
int $user_id: User ID.
Return value
bool TRUE if the user is a member, FALSE otherwise.
Overrides MeetingInterface::isMember
File
- src/
Entity/ Meeting.php, line 324
Class
- Meeting
- Defines the Workspace entity.
Namespace
Drupal\opigno_moxtra\EntityCode
public function isMember($user_id) {
$members_ids = $this
->getMembersIds();
if (empty($members_ids)) {
$training = $this
->getTraining();
if (isset($training)) {
$members_ids = array_map(function ($member) {
/** @var \Drupal\group\GroupMembership $member */
return $member
->getUser()
->id();
}, $training
->getMembers());
}
}
if (!in_array($user_id, $members_ids)) {
return FALSE;
}
return TRUE;
}