Warning: This function has been deprecated.

xprofile_avatar_upload_dir( string $directory = 'avatars', int $user_id )

Setup the avatar upload directory for a user.


Description Description


Parameters Parameters

$directory

(Optional) The root directory name. Optional.

Default value: 'avatars'

$user_id

(Required) The user ID. Optional.


Top ↑

Return Return

(array) Array containing the path, URL, and other helpful settings.


Top ↑

Source Source

File: bp-core/deprecated/6.0.php

function xprofile_avatar_upload_dir( $directory = 'avatars', $user_id = 0 ) {

	// Use displayed user if no user ID was passed.
	if ( empty( $user_id ) ) {
		$user_id = bp_displayed_user_id();
	}

	// Failsafe against accidentally nooped $directory parameter.
	if ( empty( $directory ) ) {
		$directory = 'avatars';
	}

	$path      = bp_core_avatar_upload_path() . '/' . $directory. '/' . $user_id;
	$newbdir   = $path;
	$newurl    = bp_core_avatar_url() . '/' . $directory. '/' . $user_id;
	$newburl   = $newurl;
	$newsubdir = '/' . $directory. '/' . $user_id;

	/**
	 * Filters the avatar upload directory for a user.
	 *
	 * @since 1.1.0
	 *
	 * @param array $value Array containing the path, URL, and other helpful settings.
	 */
	return apply_filters( 'xprofile_avatar_upload_dir', array(
		'path'    => $path,
		'url'     => $newurl,
		'subdir'  => $newsubdir,
		'basedir' => $newbdir,
		'baseurl' => $newburl,
		'error'   => false
	) );
}

Top ↑

Changelog Changelog

Changelog
Version Description
6.0.0 This function has been deprecated.
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.