Skip to:
Content

bbPress.org

Changeset 4679


Ignore:
Timestamp:
01/02/2013 02:01:22 PM (13 years ago)
Author:
johnjamesjacoby
Message:

Display Names:

  • Add seems_utf8() checks to topic and reply display names.
  • Improve handling of display name link title text. This is a regression from removing extract() usages.
  • Fixes #2141.
Location:
trunk/includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/core/filters.php

    r4656 r4679  
    197197add_filter( 'bbp_get_replymove_template',    'bbp_add_template_locations' );
    198198
     199// Topic and reply author display names
     200add_filter( 'bbp_get_topic_author_display_name', 'wptexturize'   );
     201add_filter( 'bbp_get_topic_author_display_name', 'convert_chars' );
     202add_filter( 'bbp_get_topic_author_display_name', 'esc_html'      );
     203add_filter( 'bbp_get_reply_author_display_name', 'wptexturize'   );
     204add_filter( 'bbp_get_reply_author_display_name', 'convert_chars' );
     205add_filter( 'bbp_get_reply_author_display_name', 'esc_html'      );
     206
    199207/**
    200208 * Add filters to anonymous post author data
  • trunk/includes/replies/template-tags.php

    r4673 r4679  
    953953            $author_name = __( 'Anonymous', 'bbpress' );
    954954
    955         return apply_filters( 'bbp_get_reply_author_display_name', esc_attr( $author_name ), $reply_id );
     955        // Encode possible UTF8 display names
     956        if ( seems_utf8( $author_name ) === false )
     957            $author_name = utf8_encode( $author_name );
     958
     959        return apply_filters( 'bbp_get_reply_author_display_name', $author_name, $reply_id );
    956960    }
    957961
     
    10511055        }
    10521056
     1057        // Reply ID is good
    10531058        if ( !empty( $reply_id ) ) {
     1059
     1060            // Tweak link title if empty
    10541061            if ( empty( $$r['link_title'] ) ) {
    10551062                $link_title = sprintf( !bbp_is_reply_anonymous( $reply_id ) ? __( 'View %s\'s profile', 'bbpress' ) : __( 'Visit %s\'s website', 'bbpress' ), bbp_get_reply_author_display_name( $reply_id ) );
     1063
     1064            // Use what was passed if not
     1065            } else {
     1066                $link_title = $r['link_title'];
    10561067            }
    10571068
    1058             $link_title = !empty( $r['link_title'] ) ? ' title="' . $r['link_title'] . '"' : '';
    1059             $author_url = bbp_get_reply_author_url( $reply_id );
    1060             $anonymous  = bbp_is_reply_anonymous( $reply_id );
     1069            $link_title   = !empty( $link_title ) ? ' title="' . $link_title . '"' : '';
     1070            $author_url   = bbp_get_reply_author_url( $reply_id );
     1071            $anonymous    = bbp_is_reply_anonymous( $reply_id );
     1072            $author_links = array();
    10611073
    10621074            // Get avatar
     
    10701082            }
    10711083
     1084            // Link class
     1085            $link_class = ' class="bbp-author-' . $r['type'] . '"';
     1086
    10721087            // Add links if not anonymous
    1073             if ( empty( $anonymous ) && bbp_user_has_profile( bbp_get_reply_author_id( $reply_id ) ) ) {
     1088            if ( empty( $anonymous ) && bbp_user_has_profile( bbp_get_reply_author_id( $topic_id ) ) ) {
     1089
     1090                // Assemble the links
    10741091                foreach ( $author_links as $link => $link_text ) {
    10751092                    $link_class = ' class="bbp-author-' . $link . '"';
     
    10781095
    10791096                if ( true === $r['show_role'] ) {
    1080                     $author_link[] = bbp_get_reply_author_role( array( 'reply_id' => $reply_id ) );
     1097                    $author_link[] = bbp_get_reply_author_role( array( 'topic_id' => $topic_id ) );
    10811098                }
    10821099
  • trunk/includes/topics/template-tags.php

    r4673 r4679  
    12631263            $author_name = __( 'Anonymous', 'bbpress' );
    12641264
    1265         return apply_filters( 'bbp_get_topic_author_display_name', esc_attr( $author_name ), $topic_id );
     1265        // Encode possible UTF8 display names
     1266        if ( seems_utf8( $author_name ) === false )
     1267            $author_name = utf8_encode( $author_name );
     1268
     1269        return apply_filters( 'bbp_get_topic_author_display_name', $author_name, $topic_id );
    12661270    }
    12671271
     
    13671371            if ( empty( $r['link_title'] ) ) {
    13681372                $link_title = sprintf( !bbp_is_topic_anonymous( $topic_id ) ? __( 'View %s\'s profile', 'bbpress' ) : __( 'Visit %s\'s website', 'bbpress' ), bbp_get_topic_author_display_name( $topic_id ) );
     1373
     1374            // Use what was passed if not
     1375            } else {
     1376                $link_title = $r['link_title'];
    13691377            }
    13701378
    1371             $r['link_title'] = !empty( $r['link_title'] ) ? ' title="' . $r['link_title'] . '"' : '';
    1372             $author_url      = bbp_get_topic_author_url( $topic_id );
    1373             $anonymous       = bbp_is_topic_anonymous( $topic_id );
    1374             $author_links    = array();
     1379            $link_title   = !empty( $link_title ) ? ' title="' . $link_title . '"' : '';
     1380            $author_url   = bbp_get_topic_author_url( $topic_id );
     1381            $anonymous    = bbp_is_topic_anonymous( $topic_id );
     1382            $author_links = array();
    13751383
    13761384            // Get avatar
Note: See TracChangeset for help on using the changeset viewer.