• Resolved timka

    (@timka)


    Is there a way to NOT show a review response on this page, but still have it sent to the review author?

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Gemini Labs

    (@geminilabs)

    [site_reviews hide="response"] to hide the response, and to send an email to the reviewer after responding, you can either use a code snippet, or use the Review Notifications add-on.

    Thread Starter timka

    (@timka)

    Thank you. Where do I insert the code [site_reviews hide=”response”]?

    Thread Starter timka

    (@timka)

    Also, if the response is hidden, does that mean no-one sees it? Then why even write the response? Or am I missing something?

    Plugin Author Gemini Labs

    (@geminilabs)

    Also, if the response is hidden, does that mean no-one sees it? Then why even write the response? Or am I missing something?

    You asked:

    1. Is there a way to NOT show a review response on this page

    If you don’t want to display the response on the page, then you can hide it by adding the “hide” option on the [site_reviews] shortcode like this:

    [site_reviews hide="response"]

    2. but still have it sent to the review author?

    you can either use a code snippet, or use the Review Notifications add-on.

    Thank you. Where do I insert the code [site_reviews hide=”response”]?

    Did someone else create that page or did you? Your page is already using the [site_reviews] shortcode, so you just need to add the “hide” option to it.

    Please see the “Site Reviews > Help > Shortcodes” page to learn more about the available shortcode options and what they do.

    Thread Starter timka

    (@timka)

    Thanks again. I now understand how to hide responses and how to send an email to the review author.

    One more question, please. If the response is hidden, and we don’t email the author, is there any reason to write a response? Who would see it if written?

    Plugin Author Gemini Labs

    (@geminilabs)

    One more question, please. If the response is hidden, and we don’t email the author, is there any reason to write a response? Who would see it if written?

    There is no reason to write responses in that case.

    Thread Starter timka

    (@timka)

    I added the code snippet referenced above but am not getting the email notification of a posted response.

    Here is where I inserted the snippet:

    class Theme {
    
    	public function __construct( $check = false ) {
    		if ( $check ) {
    			add_action( 'wp', [ $this, 'check_theme_requirements' ] );
    		}
    	}
    
    	public function init( $options ) {
    		$this->constants( $options );
    		$this->backward_compatibility();
    		$this->helpers();
    		$this->functions();
    		$this->menu_walkers();
    		$this->admin();
    		$this->theme_activated();
    		
    		add_action('site-reviews/review/responded', function ($review, $response) {
        $hasResponse = !empty($review->response);
        $hasResponseUserId = !empty(get_post_meta($review->ID, '_response_by', true));
        if (empty($response) || $hasResponse || $hasResponseUserId) {
            return; // only send an email if the response is not empty and there is no previous response
        }
        if (empty($review->email)) {
            return; // this review has not been submitted with an email
        }
        if (empty($review->assigned_posts)) {
            return; // this review has not been assigned to any Post
        }
        $postId = $review->assigned_posts[0]; // Get the first assigned Post ID
        $permalink = get_permalink($postId); // Get the permalink of the assigned Post
        $subject = sprintf('[%s], We have responded to your review!', get_bloginfo('name'));
        $message = sprintf('Just letting you know that we have <a href="%s">responded to your review</a>!', $permalink);
        $email = glsr('Modules\Email')->compose([
            'to' => $review->email,
            'subject' => $subject,
            'message' => $message,
        ]);
        $email->send();
    }, 10, 2);
    
    		add_action(
    			'admin_menu', array(
    				&$this,
    				'admin_menus',
    			)
    		);
    Plugin Author Gemini Labs

    (@geminilabs)

    The code snippet provided above will only send the notification if the review has been assigned to a page (since a link to the page that the review is assigned to is included in the message).

    Alternatively, you can try the simpler code snippet provided on the FAQ Help page:

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Hide review response’ is closed to new replies.