aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/annotations.php7
-rw-r--r--engine/lib/river2.php19
2 files changed, 22 insertions, 4 deletions
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php
index 2ca977a09..6d5c0b46a 100644
--- a/engine/lib/annotations.php
+++ b/engine/lib/annotations.php
@@ -1136,10 +1136,11 @@ function delete_annotation($id) {
$annotation = get_annotation($id);
if (trigger_elgg_event('delete', 'annotation', $annotation)) {
- return delete_data("DELETE from {$CONFIG->dbprefix}annotations where id=$id and $access");
+ remove_from_river_by_annotation($id);
+ return delete_data("DELETE from {$CONFIG->dbprefix}annotations where id=$id and $access");
}
- return false;
+ return FALSE;
}
/**
@@ -1255,4 +1256,4 @@ function register_annotation_url_handler($function_name, $extender_name = "all")
}
/** Register the hook */
-register_plugin_hook("export", "all", "export_annotation_plugin_hook", 2); \ No newline at end of file
+register_plugin_hook("export", "all", "export_annotation_plugin_hook", 2);
diff --git a/engine/lib/river2.php b/engine/lib/river2.php
index 09a6b0cc7..02a2a0732 100644
--- a/engine/lib/river2.php
+++ b/engine/lib/river2.php
@@ -96,6 +96,23 @@ function remove_from_river_by_object($object_guid) {
}
/**
+ * Removes all items relating to a particular annotation being acted upon from the river
+ *
+ * @param int annotation_id The ID of the annotation
+ * @return true|false Depending on success
+ */
+function remove_from_river_by_annotation($annotation_id) {
+ // Sanitise
+ $annotation_id = (int) $annotation_id;
+
+ // Load config
+ global $CONFIG;
+
+ // Remove
+ return delete_data("delete from {$CONFIG->dbprefix}river where annotation_id = {$annotation_id}");
+}
+
+/**
* Sets the access ID on river items for a particular object
*
* @param int $object_guid The GUID of the entity
@@ -287,4 +304,4 @@ function elgg_view_river_items($subject_guid = 0, $object_guid = 0, $subject_rel
}
return '';
-} \ No newline at end of file
+}