Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/09/2012 04:04:35 PM (14 years ago)
Author:
boonebgorges
Message:

Switch to root blog to get avatar upload directory in bp_core_avatar_upload_path().
Fixes problem that prevented locally-uploaded avatars from appearing properly on non-root sites.
Fixes #2574

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-avatars.php

    r5844 r5897  
    735735                        $basedir = BP_AVATAR_UPLOAD_PATH;
    736736                } else {
     737                        if ( !bp_is_root_blog() ) {
     738                                // Switch dynamically in order to support BP_ENABLE_MULTIBLOG
     739                                switch_to_blog( bp_get_root_blog_id() );
     740                        }
     741                       
    737742                        // Get upload directory information from current site
    738743                        $upload_dir = wp_upload_dir();
     
    744749                        } else {
    745750                                $basedir = $upload_dir['basedir'];
    746                
    747                                 // If multisite, and current blog does not match root blog, make adjustments
    748                                 if ( is_multisite() && bp_get_root_blog_id() != get_current_blog_id() )
    749                                         $basedir = get_blog_option( bp_get_root_blog_id(), 'upload_path' );
    750751                        }
     752                       
     753                        // Will bail if not switched
     754                        restore_current_blog();
    751755                }
    752756               
Note: See TracChangeset for help on using the changeset viewer.