bp_attachments_get_cover_image_settings( string $component = 'members' )

Get the cover image settings


Description Description


Parameters Parameters

$component

(Optional) The component to get the settings for ("members" for user or "groups").

Default value: 'members'


Top ↑

Return Return

(false|array) The cover image settings in array, false on failure.


Top ↑

Source Source

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

function bp_attachments_get_cover_image_settings( $component = 'xprofile' ) {
	// Default parameters.
	$args = array();

	// First look in BP Theme Compat.
	$cover_image = bp_get_theme_compat_feature( 'cover_image' );

	if ( ! empty( $cover_image ) ) {
		$args = (array) $cover_image;
	}

	/**
	 * Then let people override/set the feature using this dynamic filter
	 *
	 * Eg: for the user's profile cover image use:
	 * add_filter( 'bp_before_xprofile_cover_image_settings_parse_args', 'your_filter', 10, 1 );
	 *
	 * @since 2.4.0
	 *
	 * @param array $settings The cover image settings
	 */
	$settings = bp_parse_args( $args, array(
		'components'    => array(),
		'width'         => 1300,
		'height'        => 225,
		'callback'      => '',
		'theme_handle'  => '',
		'default_cover' => '',
	), $component . '_cover_image_settings' );

	if ( empty( $settings['components'] ) || empty( $settings['callback'] ) || empty( $settings['theme_handle'] ) ) {
		return false;
	}

	// Current component is not supported.
	if ( ! in_array( $component, $settings['components'] ) ) {
		return false;
	}

	// Finally return the settings.
	return $settings;
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.4.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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