Skip to:
Content

BuddyPress.org

Ticket #3143: 3143.patch

File 3143.patch, 2.2 KB (added by DJPaul, 14 years ago)
  • bp-core/bp-core-avatars.php

     
    563563 *
    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 = '';
    579576
     577        } else {
     578                $basedir = $upload_dir['basedir'];
     579
    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
    587585        return apply_filters( 'bp_core_avatar_upload_path', $basedir );
     
    592590 *
    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 
    619 ?>
     614?>
     615 No newline at end of file