Skip to:
Content

BuddyPress.org

Changeset 4271


Ignore:
Timestamp:
04/23/2011 10:59:25 PM (14 years ago)
Author:
djpaul
Message:

Correct avatar upload paths from r3860. Fixes #3143

File:
1 edited

Legend:

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

    r4169 r4271  
    564564 * Returns the absolute upload path for the WP installation
    565565 *
    566  * @global object $wpdb WordPress database global
    567566 * @uses wp_upload_dir To get upload directory info
    568567 * @return string Absolute path to WP upload directory
    569568 */
    570569function bp_core_avatar_upload_path() {
    571     global $wpdb;
    572 
    573570    // Get upload directory information from current site
    574571    $upload_dir = wp_upload_dir();
    575572
    576573    // Directory does not exist and cannot be created
    577     if ( isset( $upload_dir['baseurl'] ) ) {
    578         $basedir = $upload_dir['baseurl'];
     574    if ( !empty( $upload_dir['error'] ) ) {
     575        $basedir = '';
     576
     577    } else {
     578        $basedir = $upload_dir['basedir'];
    579579
    580580        // If multisite, and current blog does not match root blog, make adjustments
    581         if ( is_multisite() && BP_ROOT_BLOG != $wpdb->blogid )
     581        if ( is_multisite() && BP_ROOT_BLOG != get_current_blog_id() )
    582582            $basedir = get_blog_option( BP_ROOT_BLOG, 'upload_path' );
    583     } else {
    584         $basedir = '';
    585583    }
    586584
     
    593591 * Returns the raw base URL for root site upload location
    594592 *
    595  * @global object $wpdb WordPress database global
    596593 * @uses wp_upload_dir To get upload directory info
    597594 * @return string Full URL to current upload location
    598595 */
    599596function bp_core_avatar_url() {
    600     global $wpdb;
    601 
    602597    // Get upload directory information from current site
    603598    $upload_dir = wp_upload_dir();
    604599
    605600    // Directory does not exist and cannot be created
    606     if ( isset( $upload_dir['baseurl'] ) ) {
     601    if ( !empty( $upload_dir['error'] ) ) {
     602        $baseurl = '';
     603
     604    } else {
    607605        $baseurl = $upload_dir['baseurl'];
    608606
    609607        // If multisite, and current blog does not match root blog, make adjustments
    610         if ( is_multisite() && BP_ROOT_BLOG != $wpdb->blogid )
     608        if ( is_multisite() && BP_ROOT_BLOG != get_current_blog_id() )
    611609            $baseurl = trailingslashit( get_blog_option( BP_ROOT_BLOG, 'home' ) ) . get_blog_option( BP_ROOT_BLOG, 'upload_path' );
    612     } else {
    613         $baseurl = '';
    614610    }
    615611
    616612    return apply_filters( 'bp_core_avatar_url', $baseurl );
    617613}
    618 
    619614?>
Note: See TracChangeset for help on using the changeset viewer.