Skip to:
Content

bbPress.org

Changeset 2803


Ignore:
Timestamp:
01/14/2011 02:42:23 AM (16 years ago)
Author:
johnjamesjacoby
Message:

Correctly check for WP_Error and correctly load anonymous user cookie data/avatar. Fixes #1452. Props GautamGupta

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

Legend:

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

    r2790 r2803  
    6161                        $reply_author   = 0;
    6262
    63                         if ( !is_wp_error( $bbp->errors ) )
     63                        if ( !empty( $anonymous_data ) && is_array( $anonymous_data ) )
    6464                                bbp_set_current_anonymous_user_data( $anonymous_data );
    6565                }
  • branches/plugin/bbp-includes/bbp-topic-functions.php

    r2790 r2803  
    6262                        $topic_author   = 0;
    6363
    64                         if ( !is_wp_error( $bbp->errors ) )
     64                        if ( !empty( $anonymous_data ) && is_array( $anonymous_data ) )
    6565                                bbp_set_current_anonymous_user_data( $anonymous_data );
    6666                }
  • branches/plugin/bbp-includes/bbp-user-template.php

    r2758 r2803  
    405405         * @param int $size Size of the avatar. Defaults to 40
    406406         * @uses bbp_get_current_user_id() To get the current user id
     407         * @uses bbp_get_current_anonymous_user_data() To get the current
     408         *                                              anonymous user's email
    407409         * @uses get_avatar() To get the avatar
    408410         * @uses apply_filters() Calls 'bbp_get_current_user_avatar' with the
    … …  
    411413         */
    412414        function bbp_get_current_user_avatar( $size = 40 ) {
    413                 return apply_filters( 'bbp_get_current_user_avatar', get_avatar( bbp_get_current_user_id(), $size ), $size );
     415
     416                if ( !$user = bbp_get_current_user_id() )
     417                        $user = bbp_get_current_anonymous_user_data( 'email' );
     418
     419                return apply_filters( 'bbp_get_current_user_avatar', get_avatar( $user, $size ), $size );
    414420        }
    415421
Note: See TracChangeset for help on using the changeset viewer.