Skip to:
Content

BuddyPress.org

Changeset 6963


Ignore:
Timestamp:
04/30/2013 12:51:09 AM (11 years ago)
Author:
r-a-y
Message:

Fix bp_core_avatar_url() when used on sub-sites (1.7-branch).

Mirrors changes made in r5897 to bp_core_avatar_upload_path().

See #4948.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.7/bp-core/bp-core-avatars.php

    r6884 r6963  
    849849            $baseurl = BP_AVATAR_URL;
    850850        } else {
     851            // If multisite, and we're not on the BP root blog, switch to it
     852            if ( is_multisite() ) {
     853                switch_to_blog( bp_get_root_blog_id() );
     854            }
     855
    851856            // Get upload directory information from current site
    852857            $upload_dir = wp_upload_dir();
    853858
    854859            // Directory does not exist and cannot be created
    855             if ( !empty( $upload_dir['error'] ) ) {
     860            if ( ! empty( $upload_dir['error'] ) ) {
    856861                $baseurl = '';
    857862
     
    863868                    $baseurl = str_replace( 'http://', 'https://', $baseurl );
    864869
    865                 // If multisite, and current blog does not match root blog, make adjustments
    866                 if ( is_multisite() && bp_get_root_blog_id() != get_current_blog_id() )
    867                     $baseurl = trailingslashit( get_blog_option( bp_get_root_blog_id(), 'home' ) ) . get_blog_option( bp_get_root_blog_id(), 'upload_path' );
    868870            }
     871
     872            // Will bail if not switched
     873            restore_current_blog();
    869874        }
    870875
Note: See TracChangeset for help on using the changeset viewer.