Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/11/2020 01:33:08 PM (3 years ago)
Author:
imath
Message:

BP Blogs: improve Site Icons / Blavatar synchronization

Make sure BuddyPress tries to synchronize Sites Icons / Blavatars even when it's not network activated.

Add a new BP Repair tool to repair this synchronization. This can be needed when a different site of the network has its site icon updated after the BuddyPress Sites directory already listed this site previously.

Props vapvarun

Fixes #8384

File:
1 edited

Legend:

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

    r12772 r12779  
    381381            // Never attempted to fetch site icon before; do it now!
    382382            if ( '' === $site_icon ) {
    383                 switch_to_blog( $blog_id );
    384 
    385383                // Fetch the other size first.
    386384                if ( 'full' === $r['type'] ) {
     
    392390                }
    393391
    394                 $site_icon = get_site_icon_url( $size );
     392                $site_icon = bp_blogs_get_site_icon_url( $blog_id, $size );
     393
    395394                // Empty site icons get saved as integer 0.
    396395                if ( empty( $site_icon ) ) {
     
    404403                if ( 0 !== $site_icon ) {
    405404                    $size      = 'full' === $r['type'] ? bp_core_avatar_full_width() : bp_core_avatar_thumb_width();
    406                     $site_icon = get_site_icon_url( $size );
     405                    $site_icon = bp_blogs_get_site_icon_url( $blog_id, $size );
    407406                }
    408407
    409408                // Sync site icon to blogmeta.
    410409                bp_blogs_update_blogmeta( $blog_id, "site_icon_url_{$r['type']}", $site_icon );
    411 
    412                 restore_current_blog();
    413410            }
    414411
Note: See TracChangeset for help on using the changeset viewer.