public function can_access_group(stdClass $user, int $groupid) : bool {
        if ($this->can_access_all_groups($user)) {
            // This user has access to all groups.
            return true;
        }

        // This is a group discussion for a forum in separate groups mode.
        // Check if the user is a member.
        // This is the most expensive check.
        return groups_is_member($groupid, $user->id);
    }
public function can_access_group(stdClass $user, int $groupid) : bool {
        if ($this->can_access_all_groups($user)) {
            // This user has access to all groups.
            return true;
        }

        // This is a group discussion for a forum in separate groups mode.
        // Check if the user is a member.
        // This is the most expensive check.
        return groups_is_member($groupid, $user->id);
    }
public function can_access_group ( stdClass $ user , int $ groupid ) : bool { if ( $ this -> can_access_all_groups ( $ user ) ) { // This user has access to all groups. return true ; } // This is a group discussion for a forum in separate groups mode. // Check if the user is a member. // This is the most expensive check. return groups_is_member ( $ groupid , $ user -> id ) ; }
Can the user access the given group?

@param stdClass $user The user to check
@param int $groupid The id of the group that the forum is set to
@return bool
Can the user access the given group?