Changeset 8809
- Timestamp:
- 08/12/2014 01:10:44 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/bp-xprofile-functions.php
r8799 r8809 614 614 * Setup the avatar upload directory for a user. 615 615 * 616 * @since BuddyPress (1.0.0) 617 * 616 618 * @package BuddyPress Core 619 * 617 620 * @param string $directory The root directory name. Optional. 618 * @param int $user_id The user ID. Optional. 619 * @return array() containing the path and URL plus some other settings. 620 */ 621 function xprofile_avatar_upload_dir( $directory = false, $user_id = 0 ) { 622 623 if ( empty( $user_id ) ) 621 * @param int $user_id The user ID. Optional. 622 * 623 * @return array() Array containing the path, URL, and other helpful settings. 624 */ 625 function xprofile_avatar_upload_dir( $directory = 'avatars', $user_id = 0 ) { 626 627 // Use displayed user if no user ID was passed 628 if ( empty( $user_id ) ) { 624 629 $user_id = bp_displayed_user_id(); 625 626 if ( empty( $directory ) ) 630 } 631 632 // Failsafe against accidentally nooped $directory parameter 633 if ( empty( $directory ) ) { 627 634 $directory = 'avatars'; 628 629 $path = bp_core_avatar_upload_path() . '/avatars/' . $user_id; 635 } 636 637 $path = bp_core_avatar_upload_path() . '/' . $directory. '/' . $user_id; 630 638 $newbdir = $path; 631 639 632 if ( ! file_exists( $path ) )640 if ( ! file_exists( $path ) ) { 633 641 @wp_mkdir_p( $path ); 634 635 $newurl = bp_core_avatar_url() . '/avatars/' . $user_id; 642 } 643 644 $newurl = bp_core_avatar_url() . '/' . $directory. '/' . $user_id; 636 645 $newburl = $newurl; 637 $newsubdir = '/ avatars/' . $user_id;646 $newsubdir = '/' . $directory. '/' . $user_id; 638 647 639 648 return apply_filters( 'xprofile_avatar_upload_dir', array(
Note: See TracChangeset
for help on using the changeset viewer.