Changeset 4271
- Timestamp:
- 04/23/2011 10:59:25 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-avatars.php
r4169 r4271 564 564 * Returns the absolute upload path for the WP installation 565 565 * 566 * @global object $wpdb WordPress database global567 566 * @uses wp_upload_dir To get upload directory info 568 567 * @return string Absolute path to WP upload directory 569 568 */ 570 569 function bp_core_avatar_upload_path() { 571 global $wpdb;572 573 570 // Get upload directory information from current site 574 571 $upload_dir = wp_upload_dir(); 575 572 576 573 // 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 = ''; 576 577 } else { 578 $basedir = $upload_dir['basedir']; 579 579 580 580 // 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() ) 582 582 $basedir = get_blog_option( BP_ROOT_BLOG, 'upload_path' ); 583 } else {584 $basedir = '';585 583 } 586 584 … … 593 591 * Returns the raw base URL for root site upload location 594 592 * 595 * @global object $wpdb WordPress database global596 593 * @uses wp_upload_dir To get upload directory info 597 594 * @return string Full URL to current upload location 598 595 */ 599 596 function bp_core_avatar_url() { 600 global $wpdb;601 602 597 // Get upload directory information from current site 603 598 $upload_dir = wp_upload_dir(); 604 599 605 600 // 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 { 607 605 $baseurl = $upload_dir['baseurl']; 608 606 609 607 // 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() ) 611 609 $baseurl = trailingslashit( get_blog_option( BP_ROOT_BLOG, 'home' ) ) . get_blog_option( BP_ROOT_BLOG, 'upload_path' ); 612 } else {613 $baseurl = '';614 610 } 615 611 616 612 return apply_filters( 'bp_core_avatar_url', $baseurl ); 617 613 } 618 619 614 ?>
Note: See TracChangeset
for help on using the changeset viewer.