jigneshkaila

Untitled

Feb 28th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. add_filter('get_avatar_data', 'own_get_avatar_data', 10, 2);
  2.  
  3. function own_get_avatar_data($args, $id_or_email) {
  4.     if (is_object($id_or_email) && $id_or_email->comment_type == 'review' && $id_or_email->comment_author_email == 'noemail@gmail.com') {
  5.         $gravatar_url = get_comment_meta($id_or_email->comment_ID, 'gravatar_url', true);
  6.         if ($args['height'] == 100) {
  7.             $args['url'] = $gravatar_url;
  8.         } else {
  9.             if (!empty($args['height'])) {
  10.                 $param = $args['height'];
  11.             } elseif (!empty($args['width'])) {
  12.                 $param = $args['width'];
  13.             }
  14.             $args['url'] = str_replace('s=100', "s=$param", $gravatar_url);
  15.         }
  16.     }
  17.     return $args;
  18. }
Add Comment
Please, Sign In to add comment