bp_core_get_components

Return a list of component information.

Description

(array) bp_core_get_components( (string) $type = 'all' ); 

Returns (array)

Requested components' data.

Parameters (1)

0. $type — Optional. (string) => 'all'
Optional; component type to fetch. Default value is all,, or optional., retired, required.

Usage

  1. if ( !function_exists( 'bp_core_get_components' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-functions.php'; 
  3.  
  4. // Optional; component type to fetch. Default value is 'all', or 'optional', 'retired', 'required'. 
  5. $type = 'all'; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_core_get_components($type); 
  9.  

Defined (1)

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

/bp-core/bp-core-functions.php  
  1. function bp_core_get_components( $type = 'all' ) { 
  2. $required_components = array( 
  3. 'core' => array( 
  4. 'title' => __( 'BuddyPress Core', buddypress ),  
  5. 'description' => __( 'It‘s what makes <del>time travel</del> BuddyPress possible!', buddypress ) 
  6. ),  
  7. 'members' => array( 
  8. 'title' => __( 'Community Members', buddypress ),  
  9. 'description' => __( 'Everything in a BuddyPress community revolves around its members.', buddypress ) 
  10. ),  
  11. ); 
  12.  
  13. $retired_components = array( 
  14. 'forums' => array( 
  15. 'title' => __( 'Group Forums', buddypress ),  
  16. 'description' => sprintf( __( 'BuddyPress Forums are retired. Use %s.', buddypress ), '<a href="https://bbpress.org/">bbPress</a>' ) 
  17. ),  
  18. ); 
  19.  
  20. $optional_components = array( 
  21. 'xprofile' => array( 
  22. 'title' => __( 'Extended Profiles', buddypress ),  
  23. 'description' => __( 'Customize your community with fully editable profile fields that allow your users to describe themselves.', buddypress ) 
  24. ),  
  25. 'settings' => array( 
  26. 'title' => __( 'Account Settings', buddypress ),  
  27. 'description' => __( 'Allow your users to modify their account and notification settings directly from within their profiles.', buddypress ) 
  28. ),  
  29. 'friends' => array( 
  30. 'title' => __( 'Friend Connections', buddypress ),  
  31. 'description' => __( 'Let your users make connections so they can track the activity of others and focus on the people they care about the most.', buddypress ) 
  32. ),  
  33. 'messages' => array( 
  34. 'title' => __( 'Private Messaging', buddypress ),  
  35. 'description' => __( 'Allow your users to talk to each other directly and in private. Not just limited to one-on-one discussions, messages can be sent between any number of members.', buddypress ) 
  36. ),  
  37. 'activity' => array( 
  38. 'title' => __( 'Activity Streams', buddypress ),  
  39. 'description' => __( 'Global, personal, and group activity streams with threaded commenting, direct posting, favoriting, and @mentions, all with full RSS feed and email notification support.', buddypress ) 
  40. ),  
  41. 'notifications' => array( 
  42. 'title' => __( 'Notifications', buddypress ),  
  43. 'description' => __( 'Notify members of relevant activity with a toolbar bubble and/or via email, and allow them to customize their notification settings.', buddypress ) 
  44. ),  
  45. 'groups' => array( 
  46. 'title' => __( 'User Groups', buddypress ),  
  47. 'description' => __( 'Groups allow your users to organize themselves into specific public, private or hidden sections with separate activity streams and member listings.', buddypress ) 
  48. ),  
  49. 'forums' => array( 
  50. 'title' => __( 'Group Forums (Legacy)', buddypress ),  
  51. 'description' => __( 'Group forums allow for focused, bulletin-board style conversations.', buddypress ) 
  52. ),  
  53. 'blogs' => array( 
  54. 'title' => __( 'Site Tracking', buddypress ),  
  55. 'description' => __( 'Record activity for new posts and comments from your site.', buddypress ) 
  56. ); 
  57.  
  58. // Add blogs tracking if multisite. 
  59. if ( is_multisite() ) { 
  60. $optional_components['blogs']['description'] = __( 'Record activity for new sites, posts, and comments across your network.', buddypress ); 
  61.  
  62. switch ( $type ) { 
  63. case 'required' : 
  64. $components = $required_components; 
  65. break; 
  66. case 'optional' : 
  67. $components = $optional_components; 
  68. break; 
  69. case 'retired' : 
  70. $components = $retired_components; 
  71. break; 
  72. case 'all' : 
  73. default : 
  74. $components = array_merge( $required_components, $optional_components, $retired_components ); 
  75. break; 
  76.  
  77. /** 
  78. * Filters the list of component information. 
  79. * @since 2.6.0 
  80. * @param array $components Array of component information. 
  81. * @param string $type Type of component list requested. 
  82. * Possible values are 'all', 'optional', 'retired', 'required'. 
  83. */ 
  84. return apply_filters( 'bp_core_get_components', $components, $type );