aboutsummaryrefslogtreecommitdiff
path: root/actions/widgets/delete.php
diff options
context:
space:
mode:
Diffstat (limited to 'actions/widgets/delete.php')
-rw-r--r--actions/widgets/delete.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/actions/widgets/delete.php b/actions/widgets/delete.php
new file mode 100644
index 000000000..47920013d
--- /dev/null
+++ b/actions/widgets/delete.php
@@ -0,0 +1,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);