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

1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
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

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.