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;
153 $event_params = array_merge(
$params, $event_params);
156 _elgg_services()->events->trigger(
'join',
'group', $event_params);
180 $object = parent::prepareObject($object);
183 unset($object->read_access);
201 if (!$tool instanceof
Tool) {
205 $md_name = $tool->mapMetadataName();
206 $setting = $this->$md_name;
208 if (!isset($setting)) {
209 return $tool->isEnabledByDefault();
212 return $setting ==
'yes';
225 if (!$tool instanceof
Tool) {
229 $md_name = $tool->mapMetadataName();
230 $md_value = $tool->mapMetadataValue(
'yes');
232 $this->$md_name = $md_value;
247 if (!$tool instanceof
Tool) {
251 $md_name = $tool->mapMetadataName();
252 $md_value = $tool->mapMetadataValue(
'no');
254 $this->$md_name = $md_value;
if(!$user||!$user->canDelete()) $name
$params
Saves global plugin settings.
$mode
Configure site maintenance mode.
add_entity_relationship($guid_one, $relationship, $guid_two)
Create a relationship between two entities.
remove_entity_relationship($guid_one, $relationship, $guid_two)
Delete a relationship between two entities.
getGUID()
Returns the guid.
getTool($name)
Returns the registered tool configuration.
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
check_entity_relationship($guid_one, $relationship, $guid_two)
Check if a relationship exists between two entities.
prepareObject(\Elgg\Export\Entity $object)
{}
getMembers(array $options=[])
Get an array of group members.
const CONTENT_ACCESS_MODE_MEMBERS_ONLY
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.