bbp_get_reply_author_display_name( int $reply_id )
Return the author display_name of the reply
Description
Parameters
- $reply_id
-
(Optional) Reply id
Return
(string) Reply's author's display name
Source
File: bp-forums/replies/template.php
1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 | 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 ); } // If nothing could be found anywhere, use Anonymous if ( empty ( $author_name ) ) $author_name = __( 'Anonymous' , 'buddyboss' ); // Encode possible UTF8 display names if ( seems_utf8( $author_name ) === false ) $author_name = utf8_encode( $author_name ); return apply_filters( 'bbp_get_reply_author_display_name' , $author_name , $reply_id ); } |
Changelog
Version | Description |
---|---|
bbPress (r2667) | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.