Advertisement
geminilabs

[site-reviews] Prevent self reviews

Mar 21st, 2023
926
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.32 KB | None | 0 0
  1. add_filter('site-reviews/validate/custom', function ($result, $request) {
  2.     $userIds = explode(',', $request->assigned_users);
  3.     $userIds = array_map('intval', $userIds);
  4.     if (in_array(wp_get_current_user()->ID, $userIds)) {
  5.         return 'You are not allowed to submit a review for yourself.';
  6.     }
  7.     return $result;
  8. }, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement