Skip to:
Content

BuddyPress.org

Changeset 3860


Ignore:
Timestamp:
01/24/2011 03:17:36 AM (14 years ago)
Author:
johnjamesjacoby
Message:

Prevent debug notices if avatar directory does not exist and/or cannot be created

File:
1 edited

Legend:

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

    r3853 r3860  
    574574    $upload_dir = wp_upload_dir();
    575575
    576     // If multisite, and current blog does not match root blog, make adjustments
    577     if ( is_multisite() && BP_ROOT_BLOG != $current_blog->blog_id )
    578         $upload_dir['basedir'] = get_blog_option( BP_ROOT_BLOG, 'upload_path' );
    579 
    580     return apply_filters( 'bp_core_avatar_upload_path', $upload_dir['basedir'] );
     576    // Directory does not exist and cannot be created
     577    if ( isset( $upload_dir['baseurl'] ) ) {
     578        $basedir = $upload_dir['baseurl'];
     579
     580        // If multisite, and current blog does not match root blog, make adjustments
     581        if ( is_multisite() && BP_ROOT_BLOG != $current_blog->blog_id )
     582            $basedir = get_blog_option( BP_ROOT_BLOG, 'upload_path' );
     583    } else {
     584        $basedir = '';
     585    }
     586
     587    return apply_filters( 'bp_core_avatar_upload_path', $basedir );
    581588}
    582589
     
    596603    $upload_dir = wp_upload_dir();
    597604
    598     // If multisite, and current blog does not match root blog, make adjustments
    599     if ( is_multisite() && BP_ROOT_BLOG != $current_blog->blog_id )
    600         $upload_dir['baseurl'] = trailingslashit( get_blog_option( BP_ROOT_BLOG, 'home' ) ) . get_blog_option( BP_ROOT_BLOG, 'upload_path' );
    601 
    602     return apply_filters( 'bp_core_avatar_url', $upload_dir['baseurl'] );
     605    // Directory does not exist and cannot be created
     606    if ( isset( $upload_dir['baseurl'] ) ) {
     607        $baseurl = $upload_dir['baseurl'];
     608
     609        // If multisite, and current blog does not match root blog, make adjustments
     610        if ( is_multisite() && BP_ROOT_BLOG != $current_blog->blog_id )
     611            $baseurl = trailingslashit( get_blog_option( BP_ROOT_BLOG, 'home' ) ) . get_blog_option( BP_ROOT_BLOG, 'upload_path' );
     612    } else {
     613        $baseurl = '';
     614    }
     615
     616    return apply_filters( 'bp_core_avatar_url', $baseurl );
    603617}
    604618
Note: See TracChangeset for help on using the changeset viewer.