24 parent::initializeAttributes();
25 $this->attributes[
'subtype'] =
'group';
48 $options[
'inverse_relationship'] =
true;
70 $mode = $this->content_access_mode;
74 $mode = self::CONTENT_ACCESS_MODE_UNRESTRICTED;
76 $mode = self::CONTENT_ACCESS_MODE_MEMBERS_ONLY;
81 if (
$mode === self::CONTENT_ACCESS_MODE_MEMBERS_ONLY) {
84 return self::CONTENT_ACCESS_MODE_UNRESTRICTED;
96 if (!
$mode && $this->content_access_mode) {
101 if (
$mode !== self::CONTENT_ACCESS_MODE_MEMBERS_ONLY) {
102 $mode = self::CONTENT_ACCESS_MODE_UNRESTRICTED;
105 $this->content_access_mode =
$mode;
116 if (
$user === null) {
123 $result =
$user->hasRelationship($this->guid,
'member');
129 return _elgg_services()->hooks->triggerDeprecated(
'is_member',
'group',
$params,
$result,
"Hook 'is_member', 'group' has been deprecated. Use 'gatekeeper', 'all' hook instead.",
'4.3');
151 $event_params = array_merge(
$params, $event_params);
154 _elgg_services()->events->trigger(
'join',
'group', $event_params);
181 $object = parent::prepareObject($object);
184 unset($object->read_access);
202 if (!$tool instanceof
Tool) {
206 $md_name = $tool->mapMetadataName();
207 $setting = $this->$md_name;
209 if (!isset($setting)) {
210 return $tool->isEnabledByDefault();
213 return $setting ==
'yes';
226 if (!$tool instanceof
Tool) {
230 $md_name = $tool->mapMetadataName();
231 $md_value = $tool->mapMetadataValue(
'yes');
233 $this->$md_name = $md_value;
248 if (!$tool instanceof
Tool) {
252 $md_name = $tool->mapMetadataName();
253 $md_value = $tool->mapMetadataValue(
'no');
255 $this->$md_name = $md_value;
$params
Saves global plugin settings.
$mode
Configure site maintenance mode.
if(!$user||!$user->canDelete()) $name
getGUID()
Returns the guid.
getTool($name)
Returns the registered tool configuration.
removeRelationship($guid_two, $relationship)
Remove a relationship.
join(\ElggUser $user, $params=[])
Join a user to this group.
getContentAccessMode()
Return the content access mode.
elgg_get_entities(array $options=[])
Fetches/counts entities or performs a calculation on their properties.
const CONTENT_ACCESS_MODE_UNRESTRICTED
prepareObject(\Elgg\Export\Entity $object)
{}
getMembers(array $options=[])
Get an array of group members.
const CONTENT_ACCESS_MODE_MEMBERS_ONLY
addRelationship($guid_two, $relationship)
Add a relationship between this an another entity.
isPublicMembership()
Returns whether the current group has open membership or not.
if($email instanceof\Elgg\Email) $object
leave(\ElggUser $user)
Remove a user from the group.
disableTool($name)
Disables a tool option.
isMember(\ElggUser $user=null)
Is the given user a member of this group?
isToolEnabled($name)
Checks if a tool option is enabled.
enableTool($name)
Enables a tool option.
_elgg_services()
Get the global service provider.
canAccessContent(ElggUser $user=null)
Check if current user can access group content based on his/her membership status and group's content...
setContentAccessMode($mode)
Set the content access mode.
getDisplayName()
Get the entity's display name.