Skip to:
Content

bbPress.org

Changeset 3648


Ignore:
Timestamp:
12/28/2011 06:30:22 PM (14 years ago)
Author:
johnjamesjacoby
Message:

Fall back on user_login, and lastly "Anonymous" if no name is found anywhere. Fixes #1704.

Location:
branches/plugin/bbp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-reply-template.php

    r3636 r3648  
    868868        $reply_id = bbp_get_reply_id( $reply_id );
    869869
    870         // Check for anonymous user
    871         if ( !bbp_is_reply_anonymous( $reply_id ) )
     870        // User is not a guest
     871        if ( !bbp_is_reply_anonymous( $reply_id ) ) {
     872
     873            // Try to get a display name
    872874            $author_name = get_the_author_meta( 'display_name', bbp_get_reply_author_id( $reply_id ) );
    873         else
     875
     876            // Fall back to user login
     877            if ( empty( $author_name ) ) {
     878                $author_name = get_the_author_meta( 'user_login', bbp_get_reply_author_id( $reply_id ) );
     879            }
     880
     881        // User does not have an account
     882        } else {
    874883            $author_name = get_post_meta( $reply_id, '_bbp_anonymous_name', true );
     884        }
     885
     886        // If nothing could be found anywhere, use Anonymous
     887        if ( empty( $author_name ) )
     888            $author_name = __( 'Anonymous', 'bbpress' );
    875889
    876890        return apply_filters( 'bbp_get_reply_author_display_name', esc_attr( $author_name ), $reply_id );
  • branches/plugin/bbp-includes/bbp-topic-template.php

    r3637 r3648  
    11351135
    11361136        // Check for anonymous user
    1137         if ( !bbp_is_topic_anonymous( $topic_id ) )
     1137        if ( !bbp_is_topic_anonymous( $topic_id ) ) {
     1138
     1139            // Try to get a display name
    11381140            $author_name = get_the_author_meta( 'display_name', bbp_get_topic_author_id( $topic_id ) );
    1139         else
     1141
     1142            // Fall back to user login
     1143            if ( empty( $author_name ) ) {
     1144                $author_name = get_the_author_meta( 'user_login', bbp_get_reply_author_id( $topic_id ) );
     1145            }
     1146
     1147        // User does not have an account
     1148        } else {
    11401149            $author_name = get_post_meta( $topic_id, '_bbp_anonymous_name', true );
    1141 
    1142         return apply_filters( 'bbp_get_topic_author_id', esc_attr( $author_name ), $topic_id );
     1150        }
     1151
     1152        // If nothing could be found anywhere, use Anonymous
     1153        if ( empty( $author_name ) )
     1154            $author_name = __( 'Anonymous', 'bbpress' );
     1155
     1156        return apply_filters( 'bbp_get_topic_author_display_name', esc_attr( $author_name ), $topic_id );
    11431157    }
    11441158
Note: See TracChangeset for help on using the changeset viewer.