aboutsummaryrefslogtreecommitdiff
path: root/mod/elgg-favorites/actions/favorites/remove.php
blob: 1dd7716508fddc27a23138fdb7111c965fcd1f4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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']);
    }