diff --git src/bp-core/bp-core-functions.php src/bp-core/bp-core-functions.php
index d7da2d1..0c45bf3 100644
|
|
function bp_upload_dir() { |
2597 | 2597 | $bp = buddypress(); |
2598 | 2598 | |
2599 | 2599 | 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; |
2601 | 2602 | |
2602 | 2603 | // Maybe juggle to root blog. |
2603 | 2604 | 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 ); |
2605 | 2621 | } |
2606 | 2622 | |
2607 | 2623 | // Get the upload directory (maybe for root blog). |