Hi HivePress team,
Thanks for the quick reply!
Yes â we customized the âReview Approvedâ email in WP â HivePress â Emails. The default works on your side; on ours the customized version was using tokens like %listing_url% and %review% (object roots), which I now understand is incorrect.
To get this right, can you please confirm the exact token paths for the fields we want to display?
What we want in the vendor notification (Review Approved):
-
Listing title (as a link to the listing)
- I believe this should be:
Listing: <a href="%listing.url%">%listing.title%</a>
Please confirm %listing.url% and %listing.title%.
-
Reviewer display name
- Proposed:
%review.user.display_name%
Please confirm the correct path for the reviewerâs name.
-
Rating (stars/number)
- Proposed:
%review.rating% (or whatever field you use for rating).
Whatâs the correct token for the numeric rating?
-
Review text/body
- From your note:
%review.text%
Please confirm this is the right field to show what the user typed.
-
Our custom Review ID to help our support team track references
- We registered a field on the Review model and store it in comment-meta. Can you confirm that the following is the correct approach so
%review.review_id% becomes available in templates?
// Register Review field so %review.review_id% resolves
add_filter( 'hivepress/v1/models/review', function( $model ){
$model['fields']['review_id'] = [
'type' => 'text', // per your guidance
'_external' => true, // expose to tokens/templates
];
return $model;
}, 100 );
// Store value in comment meta where HP reads model fields for reviews
add_action( 'hivepress/v1/models/review/create', function ( $comment_id, $review ) {
if ( ! get_comment_meta( $comment_id, 'hp_review_id', true ) ) {
$code = strtoupper( wp_generate_password( 4, false, false ) ); // e.g., WTQZ
update_comment_meta( $comment_id, 'hp_review_id', $code );
}
}, 10, 2 );
-
We assume the meta key must be hp_review_id so that %review.review_id% is populated. Is that correct?
-
We also understand custom fields wonât appear in the token picker UI, but should still render if the field exists.
Proposed final template (please sanity-check tokens):
Subject: New review for you on %listing.title% â
Your listing <a href="%listing.url%">%listing.title%</a> just received a new review.
<strong>Reviewer:</strong> %review.user.display_name%
<strong>Rating:</strong> %review.rating% / 5
<strong>Review ID:</strong> %review.review_id%
<blockquote>%review.text%</blockquote>
View or reply to this review: <a href="%listing.url%">%listing.url%</a>
Extra dev note: we built a small internal debugger to confirm what tokens are in the bag per event. For this event, we see %listing.title% resolving, but wanted to verify the exact token names for reviewer name, rating, and review text, and that our custom %review.review_id% approach is correct.
If any of the above token paths differ in your implementation, could you share the canonical list for the Review Approved email? That would help us (and happy to post a summary back to the community).
Thank you so much!
William