Elgg
Version 6.1
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
engine
classes
Elgg
Comments
GroupMemberPermissionsHandler.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Elgg\Comments
;
4
10
class
GroupMemberPermissionsHandler
{
11
19
public
function
__invoke
(\
Elgg
\
Event
$event) {
20
21
if
($event->getValue() ===
false
) {
22
// already not allowed, no need to check further
23
return
;
24
}
25
26
if
(!
elgg_get_config
(
'comments_group_only'
)) {
27
return
;
28
}
29
30
$entity
= $event->getEntityParam();
31
$user
= $event->getUserParam();
32
33
if
(!
$entity
instanceof \
ElggObject
|| !
$user
instanceof \
ElggUser
) {
34
return
;
35
}
36
37
$container
=
$entity
->getContainerEntity();
38
if
(!
$container
instanceof \
ElggGroup
) {
39
return
;
40
}
41
42
if
(
$container
->isMember(
$user
)) {
43
return
;
44
}
45
46
return
false
;
47
}
48
}
elgg_get_config
elgg_get_config(string $name, $default=null)
Get an Elgg configuration value.
Definition:
configuration.php:136
Elgg\Comments\GroupMemberPermissionsHandler\__invoke
__invoke(\Elgg\Event $event)
Don't allow users to comment on content in a group they aren't a member of.
Definition:
GroupMemberPermissionsHandler.php:19
Elgg\Comments
Definition:
AutoSubscribeHandler.php:3
Elgg
Definition:
ActionsService.php:3
$entity
$entity
Definition:
reset.php:8
ElggGroup
Definition:
ElggGroup.php:14
$user
$user
Definition:
ban.php:7
$container
$container
Definition:
delete.php:23
Elgg\Comments\GroupMemberPermissionsHandler
Check if commenting on group content is allowed.
Definition:
GroupMemberPermissionsHandler.php:10
ElggObject
Definition:
ElggObject.php:15
Elgg\Event
Models an event passed to event handlers.
Definition:
Event.php:11
ElggUser
Definition:
ElggUser.php:28
Generated on Wed Dec 4 2024 00:00:20 for Elgg by
1.8.11