Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter('site-reviews-authors/can/respond', function (bool $canRespond, $review): bool {
- $user = wp_get_current_user();
- if (!in_array('company_role', (array) $user->roles)) {
- return $canRespond; // user does not have the company role
- }
- if (!in_array($user->ID, $review->assigned_users)) {
- return false; // review is not assigned to the user
- }
- if ($user->ID !== get_post()->post_author) {
- return false; // user is not the page author
- }
- return $canRespond;
- }, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement