Skip to:
Content

BuddyPress.org

Ticket #6931: 6931.patch

File 6931.patch, 1.2 KB (added by imath, 8 years ago)
  • src/bp-core/bp-core-functions.php

    diff --git src/bp-core/bp-core-functions.php src/bp-core/bp-core-functions.php
    index d7da2d1..0c45bf3 100644
    function bp_upload_dir() { 
    25972597        $bp = buddypress();
    25982598
    25992599        if ( empty( $bp->upload_dir ) ) {
    2600                 $need_switch = (bool) ( is_multisite() && ! bp_is_root_blog() );
     2600                $wp_current_site = get_current_site();
     2601                $need_switch     = (int) bp_get_root_blog_id() !== (int) $wp_current_site->blog_id;
    26012602
    26022603                // Maybe juggle to root blog.
    26032604                if ( true === $need_switch ) {
    2604                         switch_to_blog( bp_get_root_blog_id() );
     2605                        $blog_id = bp_get_root_blog_id();
     2606
     2607                        /**
     2608                         * Multiblog setups will use common uploads dir by default
     2609                         *
     2610                         * Filter here & return false to use a different upload dir for
     2611                         * each site.
     2612                         *
     2613                         * @param $value True to use common uploads dir accross the network.
     2614                         *               False otherwise.
     2615                         */
     2616                        if ( true === (bool) apply_filters( 'bp_multiblog_common_upload_dir', bp_is_multiblog_mode() ) ) {
     2617                                $blog_id = $wp_current_site->blog_id;
     2618                        }
     2619
     2620                        switch_to_blog( $blog_id );
    26052621                }
    26062622
    26072623                // Get the upload directory (maybe for root blog).