It is not possible to send the email notification (that you can edit in the Site Reviews settings) when a review is approved.
However, you can use the transition_post_status WordPress hook to send an email when a review has been approved (i.e. published).
/**
* @param string $oldStatus
* @param string $newStatus
* @param \WP_Post $post
* @return void
* @action transition_post_status
*/
add_action( 'transition_post_status', function( $newStatus, $oldStatus, $post ) {
if( in_array( $oldStatus, ['new', $newStatus] )
|| $post->post_type != 'site-review'
|| $post->post_status != 'publish'
)return;
$review = apply_filters( 'glsr_get_review', null, $post->ID );
if( !empty( $review->email )) {
$subject = '...'; // change this
$message = '...'; // change this
$sent = wp_mail( $review->email, $subject, $message );
if( !$sent ) {
apply_filters( 'glsr_log', null, 'Something went wrong and WordPress was not able to send the email to: <'.$review->email.'>' );
}
}
}, 10, 3 );
I suggest you also make use of the SendGrid plugin and service (free if you are sending less than 100 emails a day) for reliable email delivery.
I will add this feature to the roadmap for a future version.
-
This reply was modified 6 years, 2 months ago by
Gemini Labs.