Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/03/2024 06:58:50 PM (13 months ago)
Author:
espellcaste
Message:

Blogs: blog_id is accepted in the bp_get_blog_avatar, regardless if there is a blog in the current loop.

Props imath.

Closes https://github.com/buddypress/buddypress/pull/398
Fixes #9228

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-blogs/bp-blogs-template.php

    r14026 r14072  
    360360     *     @type bool     $html          Default: true.
    361361     * }
    362      * @return string User avatar string.
     362     * @return string|bool User avatar string. False if avatars are turned off.
    363363     */
    364364    function bp_get_blog_avatar( $args = '' ) {
     
    374374        $alt_attribute = __( 'Site icon for the blog', 'buddypress' );
    375375
    376         $has_current_blog = isset( $blogs_template ) && isset( $blogs_template->blog->blog_id );
    377 
    378         if ( false === $has_current_blog && isset( $args['blog_id'] ) && $args['blog_id'] ) {
     376        if ( ! empty( $args['blog_id'] ) ) {
    379377            $blog_id = (int) $args['blog_id'];
    380         } else if ( true === $has_current_blog ) {
     378        } else if ( isset( $blogs_template->blog->blog_id ) ) {
    381379            $blog_id = bp_get_blog_id();
    382380
     
    536534        global $blogs_template;
    537535
     536        $name = '';
     537
     538        if ( ! empty( $blogs_template->blog->name ) ) {
     539            $name = $blogs_template->blog->name;
     540        }
     541
    538542        /**
    539543         * Filters the name of the current blog in the loop.
     
    543547         * @param string $name Name of the current blog in the loop.
    544548         */
    545         return apply_filters( 'bp_get_blog_name', $blogs_template->blog->name );
     549        return apply_filters( 'bp_get_blog_name', $name );
    546550    }
    547551
Note: See TracChangeset for help on using the changeset viewer.