Making WordPress.org


Ignore:
Timestamp:
10/06/2022 01:52:36 AM (21 months ago)
Author:
dd32
Message:

Support Forums: Ensure that reported topics have a value displayed for who reported a topic.

This fixes get_the_author_meta( 'display_name' ) not returning a value when the WP_User object has an empty display name.

See #4644.
Fixes #6500.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/wporg-user-tweaks.php

    r10589 r12103  
    2222    return $name;
    2323}, 1, 3 );
     24
     25// Filter `get_the_author_meta()`.
     26add_filter( 'get_the_author_display_name', function( $name, $user_id ) {
     27    if ( '' === $name ) {
     28        $name = get_user_by( 'id', $user_id )->user_nicename;
     29    }
     30
     31    $name = maybe_replace_blocked_user_name( $name, $user_id );
     32
     33    return $name;
     34}, 1, 2 );
    2435
    2536// bbPress skips user filtering and does it's own
Note: See TracChangeset for help on using the changeset viewer.