bp_attachments_get_cover_image_settings

Get the cover image settings.

Description

(array|bool) bp_attachments_get_cover_image_settings( (string) $component = 'xprofile' ); 

Returns (array|bool)

The cover image settings in array, false on failure.

Parameters (1)

0. $component — Optional. (string) => 'xprofile'
The component to get the settings for ("xprofile" for user or groups).

Usage

  1. if ( !function_exists( 'bp_attachments_get_cover_image_settings' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-attachments.php'; 
  3.  
  4. // The component to get the settings for ("xprofile" for user or "groups"). 
  5. $component = 'xprofile'; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_attachments_get_cover_image_settings($component); 
  9.  

Defined (1)

The function is defined in the following location(s).

/bp-core/bp-core-attachments.php  
  1. function bp_attachments_get_cover_image_settings( $component = 'xprofile' ) { 
  2. // Default parameters. 
  3. $args = array(); 
  4.  
  5. // First look in BP Theme Compat. 
  6. $cover_image = bp_get_theme_compat_feature( 'cover_image' ); 
  7.  
  8. if ( ! empty( $cover_image ) ) { 
  9. $args = (array) $cover_image; 
  10.  
  11. /** 
  12. * Then let people override/set the feature using this dynamic filter 
  13. * Eg: for the user's profile cover image use: 
  14. * add_filter( 'bp_before_xprofile_cover_image_settings_parse_args', 'your_filter', 10, 1 ); 
  15. * @since 2.4.0 
  16. * @param array $settings The cover image settings 
  17. */ 
  18. $settings = bp_parse_args( $args, array( 
  19. 'components' => array(),  
  20. 'width' => 1300,  
  21. 'height' => 225,  
  22. 'callback' => '',  
  23. 'theme_handle' => '',  
  24. 'default_cover' => '',  
  25. ), $component . '_cover_image_settings' ); 
  26.  
  27. if ( empty( $settings['components'] ) || empty( $settings['callback'] ) || empty( $settings['theme_handle'] ) ) { 
  28. return false; 
  29.  
  30. // Current component is not supported. 
  31. if ( ! in_array( $component, $settings['components'] ) ) { 
  32. return false; 
  33.  
  34. // Finally return the settings. 
  35. return $settings;