1. The site-reviews/notification/title
hook provides access to the $review
object, so you can get an array of the assigned_posts Post IDs (this is an array because Site Reviews version 5 allows you to assign reviews to multiple pages) and get the assigned post titles from that:
$postTitles = [];
foreach ($review->assigned_posts as $postId) {
$postTitles[] = get_the_title($postId);
}
And them implode the array of post title results and use them in the subject line.
2. If you want to do this in the email message, you can use the site-reviews/email/compose
hook to modify the email data values. Simply add a custom template key to $data['template-tags']
and use that in the notification template:
/**
* @param array $data
* @param \GeminiLabs\SiteReviews\Modules\Email $email
* @return array
*/
add_filter('site-reviews/email/compose', function ($data, $email) {
$review = $email->data['review'];
$postTitles = [];
foreach ($review->assigned_posts as $postId) {
$postTitles[] = get_the_title($postId);
}
$data['template-tags']['assigned_posts'] = implode(', ', $postTitles);
return $data;
}, 10, 2);
Now you have a new template tag that you can use in the notification template:
{assigned_posts}