Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Allow frontend response if current user is author of any assigned post of the review.
- *
- * @param \GeminiLabs\SiteReviews\Review $review
- */
- add_filter('site-reviews-authors/can/respond', function (bool $canRespond, $review): bool
- {
- if (!canRespond) {
- return false;
- }
- foreach ($review->assigned_posts as $postId) {
- if (get_post_field('post_author', $postId) === get_current_user_id()) {
- return true; // user is the author of the assigned page
- }
- }
- return false;
- }, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment