From 47bfc25071afe6715aa750cc16b0f6068c67eb01 Mon Sep 17 00:00:00 2001 From: Armanul46 <47377178+Armanul46@users.noreply.github.com> Date: Wed, 22 Nov 2023 14:25:27 +0600 Subject: [PATCH] Fix bookmark issue when user not logged in (#1660) --- includes/helper-functions.php | 22 ++++++++-------------- templates/single/fields/bookmark.php | 7 ++----- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/includes/helper-functions.php b/includes/helper-functions.php index 4d4c6d6920..15981d2e7e 100644 --- a/includes/helper-functions.php +++ b/includes/helper-functions.php @@ -1744,23 +1744,17 @@ function directorist_clean($var) * */ function the_atbdp_favourites_link( $post_id = 0 ) { + if ( $post_id == 0 ) { + global $post; + $post_id = $post->ID; + } - if ( is_user_logged_in() ) { - if ( $post_id == 0 ) { - global $post; - $post_id = $post->ID; - } - - $favourites = directorist_get_user_favorites( get_current_user_id() ); - if ( in_array( $post_id, $favourites ) ) { - return directorist_icon( 'las la-heart', false, 'directorist-added-to-favorite'); - } else { - return directorist_icon( 'las la-heart', false ); - } + $favourites = directorist_get_user_favorites( get_current_user_id() ); + if ( in_array( $post_id, $favourites ) ) { + return directorist_icon( 'las la-heart', false, 'directorist-added-to-favorite'); } else { - return ''.directorist_icon( 'las la-heart', false ).''; + return directorist_icon( 'las la-heart', false ); } - } diff --git a/templates/single/fields/bookmark.php b/templates/single/fields/bookmark.php index 62487fc016..6962f32515 100644 --- a/templates/single/fields/bookmark.php +++ b/templates/single/fields/bookmark.php @@ -7,9 +7,6 @@ if ( ! defined( 'ABSPATH' ) ) exit; ?> - + - - - - + \ No newline at end of file