Elgg  Version 2.3
group.php
Go to the documentation of this file.
1 <?php
21 
22  $guid = (int)$guid;
23 
24  return get_data_row("SELECT * from {$CONFIG->dbprefix}groups_entity where guid=$guid");
25 }
26 
39 function add_group_tool_option($name, $label, $default_on = true) {
41 
42  if (!isset($CONFIG->group_tool_options)) {
43  $CONFIG->group_tool_options = array();
44  }
45 
46  $group_tool_option = new \stdClass;
47 
48  $group_tool_option->name = $name;
49  $group_tool_option->label = $label;
50  $group_tool_option->default_on = $default_on;
51 
52  $CONFIG->group_tool_options[] = $group_tool_option;
53 }
54 
67 
68  if (!isset($CONFIG->group_tool_options)) {
69  return;
70  }
71 
72  foreach ($CONFIG->group_tool_options as $i => $option) {
73  if ($option->name == $name) {
74  unset($CONFIG->group_tool_options[$i]);
75  }
76  }
77 }
78 
90  $container = $params['container'];
91  $user = $params['user'];
92  if (elgg_instanceof($container, 'group') && $user) {
93  /* @var \ElggGroup $container */
94  if ($container->isMember($user)) {
95  return true;
96  }
97  }
98 
99  return $result;
100 }
101 
112 function _elgg_groups_test($hook, $type, $value) {
113  global $CONFIG;
114  $value[] = $CONFIG->path . 'engine/tests/ElggGroupTest.php';
115  return $value;
116 }
117 
122 function _elgg_groups_init() {
123  elgg_register_plugin_hook_handler('container_permissions_check', 'all', '_elgg_groups_container_override');
124  elgg_register_plugin_hook_handler('unit_test', 'system', '_elgg_groups_test');
125 }
126 
127 return function(\Elgg\EventsService $events, \Elgg\HooksRegistrationService $hooks) {
128  $events->registerHandler('init', 'system', '_elgg_groups_init');
129 };
_elgg_groups_container_override($hook, $type, $result, $params)
Allow group members to write to the group container.
Definition: group.php:89
get_group_entity_as_row($guid)
Get the group entity.
Definition: group.php:19
if($guid==elgg_get_logged_in_user_guid()) $name
Definition: delete.php:21
$value
Definition: longtext.php:42
$guid
Removes an admin notice.
remove_group_tool_option($name)
Removes a group tool option based on name.
Definition: group.php:65
elgg_register_plugin_hook_handler($hook, $type, $callback, $priority=500)
Definition: elgglib.php:740
$params
Definition: login.php:72
elgg_instanceof($entity, $type=null, $subtype=null, $class=null)
Checks if $entity is an and optionally for type and subtype.
Definition: entities.php:736
get_data_row($query, $callback=null, array $params=[])
Retrieve a single row from the database.
Definition: database.php:72
$container
Definition: delete.php:29
_elgg_groups_test($hook, $type, $value)
Runs unit tests for the group entities.
Definition: group.php:112
global $CONFIG
$user
Definition: ban.php:13
elgg global
Pointer to the global context.
Definition: elgglib.js:12
$label
Elgg profile plugin edit default profile action.
Definition: add.php:7
_elgg_groups_init()
init the groups library private
Definition: group.php:122
add_group_tool_option($name, $label, $default_on=true)
Adds a group tool option.
Definition: group.php:39
if(!$display_name) $type
Definition: delete.php:27