24 parent::initializeAttributes();
26 $this->attributes[
'type'] =
"group";
41 'description' =>
null,
60 if (
$row instanceof \stdClass) {
63 $msg =
"Failed to load new " . get_class() .
" for GUID:" .
$row->guid;
64 throw new \IOException($msg);
66 }
else if (is_numeric(
$row)) {
70 throw new \IOException(
"Failed to load new " . get_class() .
" from GUID:" .
$row);
73 throw new \InvalidParameterException(
"Unrecognized value passed to constuctor.");
89 $this->
name = $displayName;
136 if (
$name ==
'username') {
137 return 'group:' . $this->
getGUID();
139 return parent::__get(
$name);
319 'relationship' =>
'member',
320 'inverse_relationship' =>
true,
322 'relationship_join_on' =>
'owner_guid',
372 'relationship' =>
'member',
373 'relationship_guid' => $this->
getGUID(),
374 'inverse_relationship' =>
true,
381 $options[
'relationship'] =
'member';
383 $options[
'inverse_relationship'] =
true;
407 $mode = $this->content_access_mode;
409 if (!is_string(
$mode)) {
416 $this->content_access_mode =
$mode;
420 if (
$mode === self::CONTENT_ACCESS_MODE_MEMBERS_ONLY) {
435 if (!
$mode && $this->content_access_mode) {
440 if (
$mode !== self::CONTENT_ACCESS_MODE_MEMBERS_ONLY) {
444 $this->content_access_mode =
$mode;
512 $attr_loader = new \Elgg\AttributeLoader(get_class(),
'group', $this->attributes);
513 $attr_loader->requires_access_control = !($this instanceof \ElggPlugin);
514 $attr_loader->secondary_loader =
'get_group_entity_as_row';
516 $attrs = $attr_loader->getRequiredAttributes(
$guid);
521 $this->attributes =
$attrs;
534 if (!parent::update()) {
538 $guid = (int)$this->guid;
542 $query =
"UPDATE {$CONFIG->dbprefix}groups_entity set"
543 .
" name='$name', description='$description' where guid=$guid";
545 return $this->
getDatabase()->updateData($query) !==
false;
554 $guid = parent::create();
564 $query =
"INSERT into {$CONFIG->dbprefix}groups_entity"
565 .
" (guid, name, description) values ($guid, '$name', '$description')";
597 return array_merge(parent::getExportableValues(), array(
$mode
Configure site maintenance mode.
if(! $site) if(!($site instanceof ElggSite)) $site description
if($guid==elgg_get_logged_in_user_guid()) $name
$user_guid
Avatar remove action.
getDatabase()
Provides a pointer to the database object.
loadAdditionalSelectValues(array $data)
Stores non-attributes from the loading of the entity as volatile data.
getGUID()
Returns the guid.
getExportableValues()
Return an array of fields which can be exported.
addFriend($friend_guid)
Start friendable compatibility block:
getMembers($options=array(), $offset=0, $count=false)
End friendable compatibility block.
isPublicMembership()
Returns whether the current group has open membership or not.
isFriendsWith($user_guid)
For compatibility with Friendable.
static getExternalAttributes()
Get default values for attributes stored in a separate table.
getFriendsObjects($subtype="", $limit=10, $offset=0)
For compatibility with Friendable.
create()
{Create a new entry in the entities table.Saves the base information in the entities table for the en...
update()
{Update the entity in the database.bool Whether the update was successful.}
countObjects($subtype="")
For compatibility with Friendable.
getFriends($subtype="", $limit=10, $offset=0)
For compatibility with Friendable.
initializeAttributes()
Sets the type to group.
setContentAccessMode($mode)
Set the content access mode used by group_gatekeeper()
isFriendOf($user_guid)
For compatibility with Friendable.
const CONTENT_ACCESS_MODE_MEMBERS_ONLY
isMember(\ElggUser $user=null)
Is the given user a member of this group?
load($guid)
Load the \ElggGroup data from the database.
leave(\ElggUser $user)
Remove a user from the group.
__get($name)
Wrapper around \ElggEntity::__get()
const CONTENT_ACCESS_MODE_UNRESTRICTED
join(\ElggUser $user)
Join a user to this group.
isFriend()
For compatibility with Friendable.
canComment($user_guid=0, $default=null)
Can a user comment on this group?
__construct($row=null)
Construct a new group entity.
getFriendsOf($subtype="", $limit=10, $offset=0)
For compatibility with Friendable.
addObjectToGroup(\ElggObject $object)
Add an \ElggObject to this group.
getDisplayName()
{Get the entity's display name.string The title or name of this entity.}
getObjects($subtype="", $limit=10, $offset=0)
Get objects contained in this group.
removeObjectFromGroup($object)
Remove an object from this containing group and sets the container to be object's owner.
getContentAccessMode()
Return the content access mode used by group_gatekeeper()
removeFriend($friend_guid)
For compatibility with Friendable.
prepareObject($object)
{Prepare an object copy for toObject()Object representation of the entity \stdClass}
setDisplayName($displayName)
{Sets the title or name of this entity.The title or name of this entity. void}
$guid
Removes an admin notice.
get_group_members($group_guid, $limit=10, $offset=0, $site_guid=0, $count=false)
Return a list of this group's members.
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Log a notice about deprecated use of a function, view, etc.
_elgg_services(\Elgg\Di\ServiceProvider $services=null)
Get the global service provider.
sanitize_string($string)
Sanitizes a string for use in a query.
elgg_instanceof($entity, $type=null, $subtype=null, $class=null)
Checks if $entity is an \ElggEntity and optionally for type and subtype.
get_entity($guid)
Loads and returns an entity object from a guid.
elgg_get_entities(array $options=array())
Returns an array of entities with optional filtering.
$object
These two snippets demonstrates triggering an event and how to register for that event.
if($categories) $description
elgg_get_entities_from_relationship($options)
Return entities matching a given query joining against a relationship.
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.
check_entity_relationship($guid_one, $relationship, $guid_two)
Check if a relationship exists between two entities.
get_user($guid)
Get a user object from a GUID.