aboutsummaryrefslogtreecommitdiff
path: root/mod/elgg-favorites/actions/favorites/remove.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/elgg-favorites/actions/favorites/remove.php')
-rw-r--r--mod/elgg-favorites/actions/favorites/remove.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/mod/elgg-favorites/actions/favorites/remove.php b/mod/elgg-favorites/actions/favorites/remove.php
new file mode 100644
index 000000000..1dd771650
--- /dev/null
+++ b/mod/elgg-favorites/actions/favorites/remove.php
@@ -0,0 +1,17 @@
+<?php
+ $entity_guid = (int) get_input('guid');
+ $user_guid = elgg_get_logged_in_user_guid();
+ if (($entity_guid > 0) &&
+ ($user_guid > 0) &&
+ check_entity_relationship($user_guid ,'flags_content', $entity_guid)) {
+ if (remove_entity_relationship($user_guid ,'flags_content', $entity_guid)) {
+ // elgg_dump("Notice: Removed flag relationship between $user_guid and $entity_guid. ", FALSE, 'NOTICE');
+ system_message(elgg_echo('favorites:removed'));
+ } else {
+ // elgg_dump("Could not add flag / fav relation between $user_guid and $entity_guid.", FALSE, 'WARN');
+ register_error(elgg_echo('favorites:removefailed'));
+ }
+ }
+ if (!elgg_is_xhr()) {
+ forward($_SERVER['HTTP_REFERER']);
+ }