24 parent::initializeAttributes();
26 $this->attributes[
'type'] =
"group";
27 $this->attributes[
'name'] = null;
28 $this->attributes[
'description'] = null;
29 $this->tables_split = 2;
50 if (
$row instanceof stdClass) {
53 $msg =
"Failed to load new " . get_class() .
" for GUID:" .
$row->guid;
58 elgg_deprecated_notice(
'This type of usage of the ElggGroup constructor was deprecated. Please use the clone method.', 1.7);
62 }
else if (is_numeric(
$row)) {
66 throw new IOException(
"Failed to load new " . get_class() .
" from GUID:" .
$row);
85 $this->name = $displayName;
97 return $object->
save();
132 if (
$name ==
'username') {
133 return 'group:' . $this->
getGUID();
135 return parent::__get(
$name);
332 'relationship' =>
'member',
333 'relationship_guid' => $this->
getGUID(),
334 'inverse_relationship' =>
true,
341 $options[
'relationship'] =
'member';
343 $options[
'inverse_relationship'] =
true;
367 $mode = $this->content_access_mode;
369 if (!is_string(
$mode)) {
372 $mode = self::CONTENT_ACCESS_MODE_UNRESTRICTED;
374 $mode = self::CONTENT_ACCESS_MODE_MEMBERS_ONLY;
376 $this->content_access_mode =
$mode;
380 if (
$mode === self::CONTENT_ACCESS_MODE_MEMBERS_ONLY) {
383 return self::CONTENT_ACCESS_MODE_UNRESTRICTED;
396 if (
$mode !== self::CONTENT_ACCESS_MODE_MEMBERS_ONLY) {
397 $mode = self::CONTENT_ACCESS_MODE_UNRESTRICTED;
400 $this->content_access_mode =
$mode;
438 $params = array(
'group' => $this,
'user' => $user);
454 $params = array(
'group' => $this,
'user' => $user);
469 $attr_loader->requires_access_control = !($this instanceof
ElggPlugin);
470 $attr_loader->secondary_loader =
'get_group_entity_as_row';
472 $attrs = $attr_loader->getRequiredAttributes(
$guid);
477 $this->attributes =
$attrs;
478 $this->tables_loaded = 2;
491 if (!parent::update()) {
495 $guid = (int)$this->guid;
499 $query =
"UPDATE {$CONFIG->dbprefix}groups_entity set" 500 .
" name='$name', description='$description' where guid=$guid";
502 return $this->
getDatabase()->updateData($query) !==
false;
511 $guid = parent::create();
515 $query =
"INSERT into {$CONFIG->dbprefix}groups_entity" 516 .
" (guid, name, description) values ($guid, '$name', '$description')";
548 return array_merge(parent::getExportableValues(), array(
get_objects_in_group($group_guid, $subtype="", $owner_guid=0, $site_guid=0, $order_by="", $limit=10, $offset=0, $count=FALSE)
Return an array of objects in a given container.
countObjects($subtype="")
For compatibility with Friendable.
getDatabase()
Provides a pointer to the database object.
getObjects($subtype="", $limit=10, $offset=0)
Get objects contained in this group.
leave(ElggUser $user)
Remove a user from the group.
get_group_members($group_guid, $limit=10, $offset=0, $site_guid=0, $count=false)
Return a list of this group's members.
$mode
Configure site maintenance mode.
loadAdditionalSelectValues(array $data)
Stores non-attributes from the loading of the entity as volatile data.
add_entity_relationship($guid_one, $relationship, $guid_two)
Create a relationship between two entities.
isFriend()
For compatibility with Friendable.
getFriendsObjects($subtype="", $limit=10, $offset=0)
For compatibility with Friendable.
if($guid==elgg_get_logged_in_user_guid()) $name
remove_entity_relationship($guid_one, $relationship, $guid_two)
Delete a relationship between two entities.
getMembers($options=array(), $offset=0, $count=false)
End friendable compatibility block.
addFriend($friend_guid)
Start friendable compatibility block:
if($screenshots) $description
getGUID()
Returns the guid.
$guid
Removes an admin notice.
__get($name)
Wrapper around ElggEntity::__get()
__construct($row=null)
Construct a new group entity.
sanitize_string($string)
Sanitize a string for database use.
getFriends($subtype="", $limit=10, $offset=0)
For compatibility with Friendable.
elgg_instanceof($entity, $type=null, $subtype=null, $class=null)
Checks if $entity is an ElggEntity and optionally for type and subtype.
getContentAccessMode()
Return the content access mode used by group_gatekeeper()
get_user($guid)
Get a user object from a GUID.
getFriendsOf($subtype="", $limit=10, $offset=0)
For compatibility with Friendable.
const CONTENT_ACCESS_MODE_UNRESTRICTED
initialise_attributes($pre18_api=true)
Initialise the attributes array.
elgg_trigger_plugin_hook($hook, $type, $params=null, $returnvalue=null)
Trigger a Plugin Hook and run all handler callbacks registered to that hook:type. ...
check_entity_relationship($guid_one, $relationship, $guid_two)
Check if a relationship exists between two entities.
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Sends a notice about deprecated use of a function, view, etc.
elgg global
Pointer to the global context.
isFriendsWith($user_guid)
For compatibility with Friendable.
load($guid)
Load the ElggGroup data from the database.
isMember(ElggUser $user=null)
Is the given user a member of this group?
isFriendOf($user_guid)
For compatibility with Friendable.
const CONTENT_ACCESS_MODE_MEMBERS_ONLY
isPublicMembership()
Returns whether the current group has open membership or not.
getExportableValues()
Return an array of fields which can be exported.
removeObjectFromGroup($object)
Remove an object from this containing group and sets the container to be object's owner...
setDisplayName($displayName)
{}
canComment($user_guid=0)
Can a user comment on this group?
elgg_get_logged_in_user_entity()
Return the current logged in user, or null if no user is logged in.
addObjectToGroup(ElggObject $object)
Add an ElggObject to this group.
elgg_get_entities_from_relationship($options)
Return entities matching a given query joining against a relationship.
join(ElggUser $user)
Join a user to this group.
$user_guid
Avatar remove action.
elgg_trigger_event($event, $object_type, $object=null)
Trigger an Elgg Event and attempt to run all handler callbacks registered to that event...
setContentAccessMode($mode)
Set the content access mode used by group_gatekeeper()
_elgg_cache_entity(ElggEntity $entity)
Cache an entity.
initializeAttributes()
Sets the type to group.
removeFriend($friend_guid)
For compatibility with Friendable.
get_entity($guid)
Loads and returns an entity object from a guid.