1. Make sure you are using the latest version of Site Reviews
2. If a review was submitted anonymously (i.e. by a guest user), it will have no author. You can assign an author by editing the review.
Thread Starter
lspoe2
(@lspoe2)
I will have a look.
On another note, I’m trying to show different messages for different forms when review is already submitted. I tried the below, however it doesn’t work:
add_filter('site-reviews/rendered/template/reviews-form', function ($template, $data) {
if ('site-review' != $post->post_type || '21084' != $review->form) {
$request = glsr()->request($data['args']);
return glsr('Modules\Validator\ReviewLimitsValidator', ['request' => $request])->isValid()
? $template
: sprintf('<p><i class="fas fa-check-circle"></i> %s</p>', __('Thanks for your review.'));
}}, 10, 2);
Any suggestions?
Thanks
-
This reply was modified 2 years, 6 months ago by lspoe2.
-
This reply was modified 2 years, 6 months ago by lspoe2.
Currently the only way to do this is with some inline javascript:
/**
* @param string $script
* @return string
*/
add_filter('site-reviews/enqueue/public/inline-script/after', function ($javascript) {
return $javascript."
GLSR.Event.on('site-reviews/form/handle', function (response, formEl) {
if (false !== response.errors) return; // abort if there are errors!
const formId = formEl.closest('.glsr').dataset.form; // get the custom form ID
const resultsEl = formEl.querySelector('.' + GLSR.validationconfig.form_message); // get the element which displays the submission result
if (25958 === +formId && resultsEl !== null) { // check the custom form ID (change this as needed) and make sure that we can show the message
resultsEl.innerHTML = '<p><i class=\"fas fa-check-circle\"></i> Thanks for your review.</p>';
}
});";
});
It might be preferable to use CSS if all you want to do is add an icon to the message. For example:
.glsr[data-form="25958"] .glsr-form-success::before { ... }
-
This reply was modified 2 years, 6 months ago by Gemini Labs.