Advertisement
Guest User

Untitled

a guest
Dec 16th, 2017
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. function dd_xprofile_cover_image( $settings = array() ) {
  2. $settings['default_cover'] = 'http://...';
  3. $settings['width'] = 1920;
  4. $settings['height'] = 700;
  5.  
  6. return $settings;
  7. }
  8. add_filter( 'bp_before_xprofile_cover_image_settings_parse_args', 'dd_xprofile_cover_image', 10, 1 );
  9.  
  10. function dd_groups_cover_image( $settings = array() ) {
  11. $settings['default_cover'] = 'http://....jpg';
  12. $settings['width'] = 1920;
  13. $settings['height'] = 700;
  14.  
  15. return $settings;
  16. }
  17. add_filter( 'bp_before_groups_cover_image_settings_parse_args', 'dd_groups_cover_image', 10, 1 );
  18.  
  19.  
  20.  
  21. function bp_cover_img_path() {
  22. // Is the current page a user page?
  23. if ( bp_is_user() ) {
  24.  
  25. $user_id = bp_displayed_user_id();
  26.  
  27. $attachment = bp_attachments_get_attachment( 'url', array( 'item_id' => $user_id ) );
  28.  
  29. $image_path = $attachment;
  30. // output only if an attachment exist
  31. if( !empty( $attachment ) ) { ?>
  32. <style type="text/css">
  33. .header-title.header-title-profile { background-image: url( '<?php echo $image_path; ?>' ); }
  34. </style>
  35. <?php } else { ?>
  36. <style type="text/css">
  37. .transparent-cover { display:none; }
  38. </style>
  39. <?php }
  40.  
  41. }
  42. }
  43. add_action( 'bp_profile_cover_path', 'bp_cover_img_path' );
  44.  
  45.  
  46. function bp_cover_group_img_path() {
  47. // Is the current page a user page?
  48. if ( bp_is_group() ) {
  49.  
  50. $group_id = bp_get_group_id();
  51.  
  52. $attachment = bp_attachments_get_attachment( 'url', array(
  53. 'object_dir' => 'groups',
  54. 'item_id' => $group_id,
  55. ) );
  56.  
  57. $image_path = $attachment;
  58. // output only if an attachment exist
  59. if( !empty( $attachment ) ) { ?>
  60.  
  61. <style type="text/css">
  62. .header-title.header-title-group { background-image: url( '<?php echo $image_path; ?>' ); margin-top: -133px; }
  63. </style>
  64. <?php } else { ?>
  65. <style type="text/css">
  66. .transparent-cover { display:none; }
  67. </style>
  68.  
  69. <?php }
  70. }
  71. }
  72. add_action( 'bp_group_cover_path', 'bp_cover_group_img_path' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement