Skip to:
Content

bbPress.org

Changeset 5180


Ignore:
Timestamp:
11/24/2013 09:46:41 PM (8 years ago)
Author:
netweb
Message:

Protect topic and reply author link calls from non-existant users. Props jondavidjohn. Fixes #2381

Location:
trunk/includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/replies/template.php

    r5177 r5180  
    12321232            $link_class = ' class="bbp-author-' . esc_attr( $r['type'] ) . '"';
    12331233
    1234             // Add links if not anonymous
     1234            // Add links if not anonymous and existing user
    12351235            if ( empty( $anonymous ) && bbp_user_has_profile( bbp_get_reply_author_id( $reply_id ) ) ) {
    12361236
     
    12801280     * @uses bbp_is_reply_anonymous() To check if the reply is by an anonymous
    12811281     *                                 user
     1282     * @uses bbp_user_has_profile() To check if the user has a profile
    12821283     * @uses bbp_get_reply_author_id() To get the reply author id
    12831284     * @uses bbp_get_user_profile_url() To get the user profile url
     
    12901291        $reply_id = bbp_get_reply_id( $reply_id );
    12911292
    1292         // Check for anonymous user
    1293         if ( !bbp_is_reply_anonymous( $reply_id ) ) {
     1293        // Check for anonymous user or non-existant user
     1294        if ( !bbp_is_reply_anonymous( $reply_id ) && bbp_user_has_profile( bbp_get_reply_author_id( $reply_id ) ) ) {
    12941295            $author_url = bbp_get_user_profile_url( bbp_get_reply_author_id( $reply_id ) );
    12951296        } else {
  • trunk/includes/topics/template.php

    r5157 r5180  
    15511551     * @uses bbp_is_topic_anonymous() To check if the topic is by an anonymous
    15521552     *                                 user or not
     1553     * @uses bbp_user_has_profile() To check if the user has a profile
    15531554     * @uses bbp_get_topic_author_id() To get topic author id
    15541555     * @uses bbp_get_user_profile_url() To get profile url
     
    15611562        $topic_id = bbp_get_topic_id( $topic_id );
    15621563
    1563         // Check for anonymous user
    1564         if ( !bbp_is_topic_anonymous( $topic_id ) ) {
     1564        // Check for anonymous user or non-existant user
     1565        if ( !bbp_is_topic_anonymous( $topic_id ) && bbp_user_has_profile( bbp_get_topic_author_id( $topic_id ) ) ) {
    15651566            $author_url = bbp_get_user_profile_url( bbp_get_topic_author_id( $topic_id ) );
    15661567        } else {
  • trunk/includes/users/template.php

    r5156 r5180  
    16541654            // Assemble some link bits
    16551655            $link_title = !empty( $r['link_title'] ) ? ' title="' . $r['link_title'] . '"' : '';
    1656             $author_url = bbp_get_user_profile_url( $user_id );
    16571656            $anonymous  = bbp_is_reply_anonymous( $r['post_id'] );
    16581657
     
    16691668            // Add links if not anonymous
    16701669            if ( empty( $anonymous ) && bbp_user_has_profile( $user_id ) ) {
     1670                $author_url = bbp_get_user_profile_url( $user_id );
    16711671                foreach ( $author_links as $link_text ) {
    16721672                    $author_link[] = sprintf( '<a href="%1$s"%2$s>%3$s</a>', $author_url, $link_title, $link_text );
Note: See TracChangeset for help on using the changeset viewer.