Changeset 9622
- Timestamp:
- 03/17/2015 06:05:20 PM (10 years ago)
- Location:
- trunk/src/bp-core
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-classes.php
r9619 r9622 22 22 require dirname( __FILE__ ) . '/classes/class-bp-recursive-query.php'; 23 23 require dirname( __FILE__ ) . '/classes/class-bp-media-extractor.php'; 24 require dirname( __FILE__ ) . '/classes/class-bp-attachment.php'; -
trunk/src/bp-core/bp-core-functions.php
r9615 r9622 2148 2148 return apply_filters( 'bp_core_get_suggestions', $retval, $args ); 2149 2149 } 2150 2151 /** 2152 * Set data from the BP root blog's upload directory. 2153 * 2154 * Handy for multisite instances because all uploads are made on the BP root 2155 * blog and we need to query the BP root blog for the upload directory data. 2156 * 2157 * This function ensures that we only need to use {@link switch_to_blog()} 2158 * once to get what we need. 2159 * 2160 * @since BuddyPress (2.3.0) 2161 * 2162 * @uses is_multisite() 2163 * @uses bp_is_root_blog() 2164 * @uses switch_to_blog() 2165 * @uses wp_upload_dir() 2166 * @uses restore_current_blog() 2167 */ 2168 function bp_upload_dir() { 2169 $bp = buddypress(); 2170 2171 if ( empty( $bp->upload_dir ) ) { 2172 $need_switch = (bool) ( is_multisite() && ! bp_is_root_blog() ); 2173 2174 // Maybe juggle to root blog 2175 if ( true === $need_switch ) { 2176 switch_to_blog( bp_get_root_blog_id() ); 2177 } 2178 2179 // Get the upload directory (maybe for root blog) 2180 $wp_upload_dir = wp_upload_dir(); 2181 2182 // Maybe juggle back to current blog 2183 if ( true === $need_switch ) { 2184 restore_current_blog(); 2185 } 2186 2187 // Bail if an error occurred 2188 if ( ! empty( $wp_upload_dir['error'] ) ) { 2189 return false; 2190 } 2191 2192 $bp->upload_dir = $wp_upload_dir; 2193 } 2194 2195 return $bp->upload_dir; 2196 }
Note: See TracChangeset
for help on using the changeset viewer.