attributes['subtype'] = "dmgroup"; } /** * Get list of dmgroup members. * * @param int $limit Limit * @param int $offset Offset * @param bool $count Count * @param bool $buname Order by user name * * @return mixed */ public function getMembers($limit = 10, $offset = 0, $count = false, $byname = false) { return get_dmgroup_members($this->getGUID(), $limit, $offset, 0, $count, $byname); } /** * Returns whether the current dmgroup is public membership or not. * * @returns bool */ public function isPublicMembership() { if ($this->membership == ACCESS_PUBLIC) { return true; } return false; } /** * Return whether a given user is a member of this dmgroup or not. * * @param ElggUser $user User * * @reurn bool */ public function isMember($user = 0) { if (!($user instanceof ElggUser)) { $user = elgg_get_logged_in_user_entity(); } if (!($user instanceof ElggUser)) { return false; } return is_dmgroup_member($this->getGUID(), $user->getGUID()); } /** * Join an elgg user to this dmgroup. * * @param ElggUser $user User * * @return bool */ public function join(ElggUser $user) { return join_dmgroup($this->getGUID(), $user->getGUID()); } /** * Remove a user from the group. * * @param ElggUser $user User * * @return void */ public function leave(ElggUser $user) { return leave_dmgroup($this->getGUID(), $user->getGUID()); } }