Skip to content

Commit

Permalink
Merge pull request #4338 from corentin-soriano/fix_fav_remove_issue
Browse files Browse the repository at this point in the history
Fix favorites remove issue.
  • Loading branch information
nilsteampassnet authored Sep 20, 2024
2 parents dbd5b58 + 6fb779e commit 61d529b
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions sources/favourites.queries.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,8 @@
//Get actual favourites
$data = DB::queryfirstrow('SELECT favourites FROM '.prefixTable('users').' WHERE id = %i', $session->get('user-id'));
$tmp = explode(';', $data['favourites']);
$favorites = '';
$arrayFavorites = array();
//redefine new list of favourites
foreach ($tmp as $favorite) {
if (!empty($favorite) && $favorite != $post_id) {
if (empty($favorites)) {
$favorites = $favorite;
} else {
$favorites = ';'.$favorite;
}
array_push($arrayFavorites, $favorite);
}
}
$arrayFavorites = array_diff($tmp, [$post_id]);

//update user's account
DB::update(
prefixTable('users'),
Expand Down

0 comments on commit 61d529b

Please sign in to comment.