Esempio n. 1
0
 /**
  * Gets the avatar information for the user.  The avatars are provided by
  * plugins that can integrate with a variety of services like gravatar.com,
  * LDAP, Social Identities, etc.
  *
  * If logged in user doesn't have access to view avatars or not avatar is found,
  * then a default avatar will be used.
  *
  * Note that the provided user id may no longer has a corresponding user in the
  * system, if the user was deleted.
  *
  * @param integer $p_user_id  The user id.
  * @param integer $p_size     The desired width/height of the avatar.
  *
  * @return array The array with avatar information.
  */
 public static function get($p_user_id, $p_size = 80)
 {
     $t_enabled = config_get('show_avatar') !== OFF;
     $t_avatar = null;
     if ($t_enabled) {
         $t_user_exists = user_exists($p_user_id);
         if ($t_user_exists && access_has_project_level(config_get('show_avatar_threshold'), null, $p_user_id)) {
             $t_avatar = event_signal('EVENT_USER_AVATAR', array($p_user_id, $p_size));
         }
         if ($t_avatar === null) {
             $t_avatar = new Avatar();
         }
         $t_avatar->normalize($p_user_id, $t_user_exists);
     }
     return $t_avatar;
 }