Advertisement
geminilabs

[site-reviews] add author URL links to {assigned_users} tag

Feb 8th, 2024
916
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.47 KB | None | 0 0
  1. add_filter('site-reviews/review/value/assigned_users', function ($value, $tag) {
  2.     $users = [];
  3.     foreach ($tag->review->assignedUsers() as $user) {
  4.         $url = get_author_posts_url($user->ID); // change this part if using custom User URLs
  5.         $users[] = sprintf('<a href="%s">%s</a>', $url, $user->display_name);
  6.     }
  7.     $and = __('and', 'site-reviews');
  8.     $values[] = implode(" {$and} ", array_splice($users, -2));
  9.     return implode(', ', $values);
  10. }, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement