Skip to:
Content

BuddyPress.org

Changeset 3051


Ignore:
Timestamp:
06/14/2010 09:58:14 AM (15 years ago)
Author:
johnjamesjacoby
Message:

Fix #2426

File:
1 edited

Legend:

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

    r3035 r3051  
    472472}
    473473
     474/**
     475 * bp_core_avatar_upload_path()
     476 *
     477 * Returns the absolute upload path for the WP installation
     478 *
     479 * @global object $current_blog Current blog information
     480 * @uses wp_upload_dir To get upload directory info
     481 * @return string Absolute path to WP upload directory
     482 */
    474483function bp_core_avatar_upload_path() {
     484    global $current_blog;
     485
     486    // Get upload directory information from current site
    475487    $upload_dir = wp_upload_dir();
     488
     489    // If multisite, and current blog does not match root blog, make adjustments
     490    if ( is_multisite() && BP_ROOT_BLOG != $current_blog->blog_id )
     491        $upload_dir['basedir'] = str_replace( $current_blog->blog_id, BP_ROOT_BLOG, BLOGUPLOADDIR );
     492
    476493    return apply_filters( 'bp_core_avatar_upload_path', $upload_dir['basedir'] );
    477494}
    478495
     496/**
     497 * bp_core_avatar_url()
     498 *
     499 * Returns the raw base URL for root site upload location
     500 *
     501 * @global object $current_blog Current blog information
     502 * @uses wp_upload_dir To get upload directory info
     503 * @return string Full URL to current upload location
     504 */
    479505function bp_core_avatar_url() {
     506    global $current_blog;
     507
     508    // Get upload directory information from current site
    480509    $upload_dir = wp_upload_dir();
     510
     511    // If multisite, and current blog does not match root blog, make adjustments
     512    if ( is_multisite() && BP_ROOT_BLOG != $current_blog->blog_id )
     513        $upload_dir['baseurl'] = str_replace( get_blog_option( $current_blog->blog_id, 'home' ) , get_blog_option( BP_ROOT_BLOG, 'home' ), $upload_dir['baseurl'] );
     514
    481515    return apply_filters( 'bp_core_avatar_url', $upload_dir['baseurl'] );
    482516}
Note: See TracChangeset for help on using the changeset viewer.