bp_attachments_cover_image_upload_dir( $args = array() )

Gets the upload dir array for cover photos.

Description

Return

(array) See wp_upload_dir().

Source

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

function bp_attachments_cover_image_upload_dir( $args = array() ) {
	// Default values are for profiles.
	$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 photo upload directory.
	 *
	 * @since BuddyPress 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 );
}

Changelog

Changelog
Version Description
BuddyPress 3.0.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.