grofiles_get_avatar

Stores the user ID or email address for each gravatar generated.

Description

grofiles_get_avatar( (string) $avatar, (mixed) $author ); 

Attached to the get_avatar filter.

Parameters (2)

0. $avatar (string)
The element of the avatar.
1. $author (mixed)
User ID, email address, user login, comment object, user object, post object

Usage

  1. if ( !function_exists( 'grofiles_get_avatar' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'jetpack-by-wordpress-com/modules/gravatar-hovercards.php'; 
  3.  
  4. // The element of the avatar. 
  5. $avatar = ''; 
  6.  
  7. // User ID, email address, user login, comment object, user object, post object 
  8. $author = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = grofiles_get_avatar($avatar, $author); 
  12.  

Defined (1)

The function is defined in the following location(s).

/modules/gravatar-hovercards.php  
  1. function grofiles_get_avatar( $avatar, $author ) { 
  2. if ( is_numeric( $author ) ) { 
  3. } else if ( is_string( $author ) ) { 
  4. if ( false !== strpos( $author, '@' ) ) { 
  5. } else { 
  6. if ( $user = get_user_by( 'slug', $author ) ) 
  7. } else if ( isset( $author->comment_type ) ) { 
  8. if ( '' != $author->comment_type && 'comment' != $author->comment_type ) 
  9. return $avatar; 
  10. if ( $author->user_id ) 
  11. grofiles_gravatars_to_append( $author->user_id ); 
  12. else 
  13. grofiles_gravatars_to_append( $author->comment_author_email ); 
  14. } else if ( isset( $author->user_login ) ) { 
  15. grofiles_gravatars_to_append( $author->ID ); 
  16. } else if ( isset( $author->post_author ) ) { 
  17. grofiles_gravatars_to_append( $author->post_author ); 
  18.  
  19. return $avatar;