bp_attachments_get_cover_image_settings( string $component = 'members' )

Get the cover image settings


Parameters Parameters

$component

(string) (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.


Source Source

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

function bp_attachments_get_cover_image_settings( $component = 'members' ) {
	// 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;
	}

	// Set default args.
	$default_args = wp_parse_args(
		$args,
		array(
			'components'    => array(),
			'width'         => 1300,
			'height'        => 225,
			'callback'      => '',
			'theme_handle'  => '',
			'default_cover' => '',
		)
	);

	// Handle deprecated xProfile fitler.
	if ( 'members' === $component ) {
		/** This filter is documented in wp-includes/deprecated.php */
		$args = apply_filters_deprecated( 'bp_before_xprofile_cover_image_settings_parse_args', array( $default_args ), '6.0.0', 'bp_before_members_cover_image_settings_parse_args' );
	}

	/**
	 * Then let people override/set the feature using this dynamic filter
	 *
	 * Eg: for the user's profile cover image use:
	 * add_filter( 'bp_before_members_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, $default_args, $component . '_cover_image_settings' );

	// Handle deprecated xProfile fitler.
	if ( 'members' === $component ) {
		/** This filter is documented in wp-includes/deprecated.php */
		$settings = apply_filters_deprecated( 'bp_after_xprofile_cover_image_settings_parse_args', array( $settings ), '6.0.0', 'bp_after_members_cover_image_settings_parse_args' );
	}

	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.