Skip to:
Content

BuddyPress.org

Changeset 5898


Ignore:
Timestamp:
03/09/2012 04:05:59 PM (15 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
  • branches/1.5/bp-core/bp-core-avatars.php

    r5626 r5898  
    663663                        $basedir = BP_AVATAR_UPLOAD_PATH;
    664664                } else {
     665                        if ( !bp_is_root_blog() ) {
     666                                // Switch dynamically in order to support BP_ENABLE_MULTIBLOG
     667                                switch_to_blog( bp_get_root_blog_id() );
     668                        }
     669                       
    665670                        // Get upload directory information from current site
    666671                        $upload_dir = wp_upload_dir();
    … …  
    672677                        } else {
    673678                                $basedir = $upload_dir['basedir'];
    674                
    675                                 // If multisite, and current blog does not match root blog, make adjustments
    676                                 if ( is_multisite() && bp_get_root_blog_id() != get_current_blog_id() )
    677                                         $basedir = get_blog_option( bp_get_root_blog_id(), 'upload_path' );
    678679                        }
     680                       
     681                        // Will bail if not switched
     682                        restore_current_blog();
    679683                }
    680684               
Note: See TracChangeset for help on using the changeset viewer.