diff --git a/sources/favourites.queries.php b/sources/favourites.queries.php index 1325b37c0..aa23f5a9d 100755 --- a/sources/favourites.queries.php +++ b/sources/favourites.queries.php @@ -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'),