aboutsummaryrefslogtreecommitdiff
path: root/actions/widgets/delete.php
blob: 47920013d9c14a2c842238041dd776a6e226a1d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
/**
 * Elgg widget delete action
 *
 * @package Elgg.Core
 * @subpackage Widgets.Management
 */

$widget_guid = get_input('widget_guid');
$owner_guid = get_input('owner_guid', elgg_get_logged_in_user_guid());

$widget = get_entity($widget_guid);
$owner = get_entity($owner_guid);

if ($widget && $owner->canEdit() && $widget->delete()) {
	forward(REFERER);
}

register_error(elgg_echo('widgets:remove:failure'));
forward(REFERER);