bbp_get_reply_author_display_name( int $reply_id )
Return the author display_name of the reply
Description Description
Parameters Parameters
- $reply_id
-
(Optional) Reply id
Return Return
(string) The display name of the author of the reply
Source Source
File: includes/replies/template.php
function bbp_get_reply_author_display_name( $reply_id = 0 ) { $reply_id = bbp_get_reply_id( $reply_id ); // User is not a guest if ( ! bbp_is_reply_anonymous( $reply_id ) ) { // Get the author ID $author_id = bbp_get_reply_author_id( $reply_id ); // Try to get a display name $author_name = get_the_author_meta( 'display_name', $author_id ); // Fall back to user login if ( empty( $author_name ) ) { $author_name = get_the_author_meta( 'user_login', $author_id ); } // User does not have an account } else { $author_name = get_post_meta( $reply_id, '_bbp_anonymous_name', true ); } // Fallback if nothing could be found if ( empty( $author_name ) ) { $author_name = bbp_get_fallback_display_name( $reply_id ); } // Encode possible UTF8 display names if ( seems_utf8( $author_name ) === false ) { $author_name = utf8_encode( $author_name ); } // Filter & return return apply_filters( 'bbp_get_reply_author_display_name', $author_name, $reply_id ); }
Changelog Changelog
Version | Description |
---|---|
2.0.0 | Introduced. |