bp_attachments_get_cover_image_settings( string $component = 'xprofile' )
Get the cover photo settings
Description
Parameters
- $component
-
(Optional) The component to get the settings for ("xprofile" for user or "groups").
Default value: 'xprofile'
Return
(false|array) The cover photo settings in array, false on failure.
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 photo use:
* add_filter( 'bp_before_xprofile_cover_image_settings_parse_args', 'your_filter', 10, 1 );
*
* @since BuddyPress 2.4.0
*
* @param array $settings The cover photo 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;
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 2.4.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.