bp_attachments_cover_image_upload_dir( $args = array() )

Gets the upload dir array for cover images.


Return Return

(array) See wp_upload_dir().


Source Source

File: bp-core/bp-core-attachments.php

function bp_attachments_cover_image_upload_dir( $args = array() ) {
	// Default values are for members.
	$object_id = bp_displayed_user_id();

	if ( empty( $object_id ) ) {
		$object_id = bp_loggedin_user_id();
	}

	$object_directory = 'members';

	// We're in a group, edit default values.
	if ( bp_is_group() || bp_is_group_create() ) {
		$object_id        = bp_get_current_group_id();
		$object_directory = 'groups';
	}

	$r = bp_parse_args( $args, array(
		'object_id' => $object_id,
		'object_directory' => $object_directory,
	), 'cover_image_upload_dir' );


	// Set the subdir.
	$subdir  = '/' . $r['object_directory'] . '/' . $r['object_id'] . '/cover-image';

	$upload_dir = bp_attachments_uploads_dir_get();

	/**
	 * Filters the cover image upload directory.
	 *
	 * @since 2.4.0
	 *
	 * @param array $value      Array containing the path, URL, and other helpful settings.
	 * @param array $upload_dir The original Uploads dir.
	 */
	return apply_filters( 'bp_attachments_cover_image_upload_dir', array(
		'path'    => $upload_dir['basedir'] . $subdir,
		'url'     => set_url_scheme( $upload_dir['baseurl'] ) . $subdir,
		'subdir'  => $subdir,
		'basedir' => $upload_dir['basedir'],
		'baseurl' => set_url_scheme( $upload_dir['baseurl'] ),
		'error'   => false,
	), $upload_dir );
}


Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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