Changeset 12555 for trunk/src/bp-xprofile/bp-xprofile-functions.php
- Timestamp:
- 02/29/2020 03:38:06 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/bp-xprofile-functions.php
r12533 r12555 707 707 708 708 /** 709 * Setup the avatar upload directory for a user.710 *711 * @since 1.0.0712 *713 * @package BuddyPress Core714 *715 * @param string $directory The root directory name. Optional.716 * @param int $user_id The user ID. Optional.717 * @return array Array containing the path, URL, and other helpful settings.718 */719 function xprofile_avatar_upload_dir( $directory = 'avatars', $user_id = 0 ) {720 721 // Use displayed user if no user ID was passed.722 if ( empty( $user_id ) ) {723 $user_id = bp_displayed_user_id();724 }725 726 // Failsafe against accidentally nooped $directory parameter.727 if ( empty( $directory ) ) {728 $directory = 'avatars';729 }730 731 $path = bp_core_avatar_upload_path() . '/' . $directory. '/' . $user_id;732 $newbdir = $path;733 $newurl = bp_core_avatar_url() . '/' . $directory. '/' . $user_id;734 $newburl = $newurl;735 $newsubdir = '/' . $directory. '/' . $user_id;736 737 /**738 * Filters the avatar upload directory for a user.739 *740 * @since 1.1.0741 *742 * @param array $value Array containing the path, URL, and other helpful settings.743 */744 return apply_filters( 'xprofile_avatar_upload_dir', array(745 'path' => $path,746 'url' => $newurl,747 'subdir' => $newsubdir,748 'basedir' => $newbdir,749 'baseurl' => $newburl,750 'error' => false751 ) );752 }753 754 /**755 709 * When search_terms are passed to BP_User_Query, search against xprofile fields. 756 710 *
Note: See TracChangeset
for help on using the changeset viewer.