Elgg
Version master
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
engine
classes
Elgg
Comments
EditPermissionsHandler.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Elgg\Comments
;
4
10
class
EditPermissionsHandler
{
11
19
public
function
__invoke
(\
Elgg
\
Event
$event) {
20
$entity
= $event->getEntityParam();
21
$user
= $event->getUserParam();
22
23
if
(!
$entity
instanceof \
ElggComment
|| !
$user
instanceof \
ElggUser
) {
24
return
;
25
}
26
27
$return =
function
() use (
$entity
,
$user
) {
28
return
$entity
->owner_guid ===
$user
->guid;
29
};
30
31
$content
=
$entity
->getContainerEntity();
32
if
(!
$content
instanceof \
ElggEntity
) {
33
return
$return();
34
}
35
36
$container
=
$content
->getContainerEntity();
37
38
// use default access for group editors to moderate comments
39
if
(
$container
instanceof \
ElggGroup
&&
$container
->canEdit(
$user
->guid)) {
40
return
;
41
}
42
43
return
$return();
44
}
45
}
ElggComment
Definition:
ElggComment.php:11
Elgg\Comments\EditPermissionsHandler\__invoke
__invoke(\Elgg\Event $event)
This makes sure only authors can edit their comments.
Definition:
EditPermissionsHandler.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\EditPermissionsHandler
Returns the correct behaviour for editing comments.
Definition:
EditPermissionsHandler.php:10
ElggEntity
Definition:
ElggEntity.php:52
$content
$content
Set robots.txt action.
Definition:
set_robots.php:6
Elgg\Event
Models an event passed to event handlers.
Definition:
Event.php:11
ElggUser
Definition:
ElggUser.php:28
Generated on Mon Oct 14 2024 00:03:03 for Elgg by
1.8.11