aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2012-07-07 03:03:04 +0200
committerSem <sembrestels@riseup.net>2012-07-07 03:03:04 +0200
commit2329cb233a8766ac1a6bc5d5b4d699f2ab773ea4 (patch)
tree9532b5aaa98df42a31d883af9a5ce22caad02ab5
parentb2f46500941a2093734e7672a4de79aabd95b9fc (diff)
downloadelgg-2329cb233a8766ac1a6bc5d5b4d699f2ab773ea4.tar.gz
elgg-2329cb233a8766ac1a6bc5d5b4d699f2ab773ea4.tar.bz2
Fixes #4631. Admins are now able to delete river items.
-rw-r--r--actions/river/delete.php21
-rw-r--r--engine/lib/navigation.php12
-rw-r--r--engine/lib/river.php4
-rw-r--r--languages/en.php2
4 files changed, 38 insertions, 1 deletions
diff --git a/actions/river/delete.php b/actions/river/delete.php
new file mode 100644
index 000000000..0d8297932
--- /dev/null
+++ b/actions/river/delete.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * River item delete action
+ *
+ * @package Elgg
+ * @subpackage Core
+ */
+
+$id = get_input('id', false);
+
+if ($id !== false && elgg_is_admin_logged_in()) {
+ if (elgg_delete_river(array('id' => $id))) {
+ system_message(elgg_echo('river:delete:success'));
+ } else {
+ register_error(elgg_echo('river:delete:fail'));
+ }
+} else {
+ register_error(elgg_echo('river:delete:fail'));
+}
+
+forward(REFERER);
diff --git a/engine/lib/navigation.php b/engine/lib/navigation.php
index 4ff009bfb..61d283f4b 100644
--- a/engine/lib/navigation.php
+++ b/engine/lib/navigation.php
@@ -335,6 +335,18 @@ function elgg_river_menu_setup($hook, $type, $return, $params) {
$return[] = ElggMenuItem::factory($options);
}
}
+
+ if ($object->canEdit() && elgg_is_admin_logged_in()) {
+ $options = array(
+ 'name' => 'delete',
+ 'href' => "action/river/delete?id=$item->id",
+ 'text' => elgg_view_icon('delete'),
+ 'title' => elgg_echo('delete'),
+ 'is_action' => true,
+ 'priority' => 200,
+ );
+ $return[] = ElggMenuItem::factory($options);
+ }
}
return $return;
diff --git a/engine/lib/river.php b/engine/lib/river.php
index 711832f70..b717a7756 100644
--- a/engine/lib/river.php
+++ b/engine/lib/river.php
@@ -643,9 +643,11 @@ function elgg_river_init() {
elgg_register_page_handler('activity', 'elgg_river_page_handler');
$item = new ElggMenuItem('activity', elgg_echo('activity'), 'activity');
elgg_register_menu_item('site', $item);
-
+
elgg_register_widget_type('river_widget', elgg_echo('river:widget:title'), elgg_echo('river:widget:description'));
+ elgg_register_action('river/delete', '', 'admin');
+
elgg_register_plugin_hook_handler('unit_test', 'system', 'elgg_river_test');
}
diff --git a/languages/en.php b/languages/en.php
index 7cd091115..7b4bc9771 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -437,6 +437,8 @@ $english = array(
'river:ingroup' => 'in the group %s',
'river:none' => 'No activity',
'river:update' => 'Update for %s',
+ 'river:delete:success' => 'River item has been deleted',
+ 'river:delete:fail' => 'River item could not be deleted',
'river:widget:title' => "Activity",
'river:widget:description' => "Display latest activity",