WordPress.org

Make WordPress Core

Ticket #44033: 44033.diff

File 44033.diff, 1.8 KB (added by dshanske, 2 years ago)
  • src/wp-includes/link-template.php

     
    39273927        return $args['url'];
    39283928}
    39293929
     3930
     3931/**
     3932 * Is this an allowed comment type for retrieving avatars.
     3933 *
     3934 * @since 4.9.7
     3935 *
     3936 * @param string $comment_type Comment Type
     3937 *
     3938 * @return false|string The URL of the avatar we found, or false if we couldn't find an avatar.
     3939 */
     3940function is_avatar_comment_type( $comment_type ) {
     3941        /**
     3942         * Filters the list of allowed comment types for retrieving avatars.
     3943         *
     3944         * @since 3.0.0
     3945         *
     3946         * @param array $types An array of content types. Default only contains 'comment'.
     3947         */
     3948        $allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );
     3949        return in_array( $comment_type, (array) $allowed_comment_types );
     3950}
     3951
     3952
    39303953/**
    39313954 * Retrieves default data about the avatar.
    39323955 *
     
    40714094                // Post Object
    40724095                $user = get_user_by( 'id', (int) $id_or_email->post_author );
    40734096        } elseif ( $id_or_email instanceof WP_Comment ) {
    4074                 /**
    4075                  * Filters the list of allowed comment types for retrieving avatars.
    4076                  *
    4077                  * @since 3.0.0
    4078                  *
    4079                  * @param array $types An array of content types. Default only contains 'comment'.
    4080                  */
    4081                 $allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );
    4082                 if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) {
     4097                if ( ! is_avatar_comment_type( get_comment_type( $id_or_email ) ) ) {
    40834098                        $args['url'] = false;
    40844099                        /** This filter is documented in wp-includes/link-template.php */
    40854100                        return apply_filters( 'get_avatar_data', $args, $id_or_email );