aboutsummaryrefslogtreecommitdiff
path: root/mod/likes/actions
diff options
context:
space:
mode:
Diffstat (limited to 'mod/likes/actions')
-rw-r--r--mod/likes/actions/likes/delete.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/mod/likes/actions/likes/delete.php b/mod/likes/actions/likes/delete.php
index 88cb84467..322d512e8 100644
--- a/mod/likes/actions/likes/delete.php
+++ b/mod/likes/actions/likes/delete.php
@@ -4,8 +4,23 @@
*
*/
+// Support deleting by id in case we're deleting another user's likes
$id = (int) get_input('id');
-$like = elgg_get_annotation_from_id($id);
+
+$like = NULL;
+if ($id) {
+ $like = elgg_get_annotation_from_id($id);
+}
+
+if (!$like) {
+ $likes = elgg_get_annotations(array(
+ 'guid' => (int) get_input('guid'),
+ 'annotation_owner_guid' => elgg_get_logged_in_user_guid(),
+ 'annotation_name' => 'likes',
+ ));
+ $like = $likes[0];
+}
+
if ($like && $like->canEdit()) {
$like->delete();
system_message(elgg_echo("likes:deleted"));