bp_core_get_components( string $type = 'all' )
Return a list of component information.
Description
Parameters
- $type
-
(Optional) component type to fetch. Default value is 'all', or 'optional', 'required', 'default'.
Default value: 'all'
Return
(array) Requested components' data.
Source
File: bp-core/bp-core-functions.php
function bp_core_get_components( $type = 'all' ) {
$required_components = array(
'members' => array(
'title' => __( 'Member Profiles', 'buddyboss' ),
'settings' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings', 'tab' => 'bp-xprofile' ) , 'admin.php' ) ),
'description' => __( 'Everything in a community website revolves around its members. All website users are given member profiles.', 'buddyboss' ),
),
'xprofile' => array(
'title' => __( 'Profile Fields', 'buddyboss' ),
'settings' => bp_get_admin_url( 'admin.php?page=bp-profile-setup' ),
'description' => __( 'Customize your community with fully editable profile fields that allow members to share details about themselves.', 'buddyboss' ),
'default' => true,
),
);
$optional_components = array(
'settings' => array(
'title' => __( 'Account Settings', 'buddyboss' ),
'description' => __( 'Allow members to modify their account and notification settings from within their profile.', 'buddyboss' ),
'default' => true,
),
'notifications' => array(
'title' => __( 'Notifications', 'buddyboss' ),
'description' => __( 'Notify members of relevant activity with a toolbar bubble and/or via email and allow them to customize their notification settings.', 'buddyboss' ),
'default' => true,
),
'groups' => array(
'title' => __( 'Social Groups', 'buddyboss' ),
'settings' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings', 'tab' => 'bp-groups' ) , 'admin.php' ) ),
'description' => __( 'Allow members to organize themselves into public, private or hidden social groups with separate activity feeds and member listings.', 'buddyboss' ),
'default' => false,
),
'forums' => array(
'title' => __( 'Forum Discussions', 'buddyboss' ),
'settings' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings', 'tab' => 'bp-forums' ) , 'admin.php' ) ),
'description' => __( 'Allow members to have discussions using Q&A style message boards. Forums can be standalone or connected to social groups.', 'buddyboss' ),
'default' => false,
),
'activity' => array(
'title' => __( 'Activity Feeds', 'buddyboss' ),
'settings' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings', 'tab' => 'bp-activity' ) , 'admin.php' ) ),
'description' => __( 'Global, personal, and group activity feeds with threaded commenting, direct posting, and @mentions, with email notification support.', 'buddyboss' ),
'default' => false,
),
'media' => array(
'title' => __( 'Media Uploading', 'buddyboss' ),
'settings' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings', 'tab' => 'bp-media' ) , 'admin.php' ) ),
'description' => __( 'Allow members to upload photos, emojis and animated GIFs, and to organize photos into albums.', 'buddyboss' ),
'default' => false,
),
'messages' => array(
'title' => __( 'Private Messaging', 'buddyboss' ),
'description' => __( 'Allow members to send private messages. Messages can be sent to one member or a group of members.', 'buddyboss' ),
'default' => false,
),
'friends' => array(
'title' => __( 'Member Connections', 'buddyboss' ),
'settings' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings', 'tab' => 'bp-friends' ) , 'admin.php' ) ),
'description' => __( 'Allow members to make connections with one another and focus on those they care about most.', 'buddyboss' ),
'default' => false,
),
'invites' => array(
'title' => __( 'Email Invites', 'buddyboss' ),
'settings' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings', 'tab' => 'bp-invites' ) , 'admin.php' ) ),
'description' => __( 'Allow members to send email invitations to non-members to join the network.', 'buddyboss' ),
'default' => false,
),
'search' => array(
'title' => __( 'Network Search', 'buddyboss' ),
'settings' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings', 'tab' => 'bp-search' ) , 'admin.php' ) ),
'description' => __( 'Allow members to search the entire network, along with custom post types of your choice, all in one unified search bar.', 'buddyboss' ),
'default' => false,
),
'blogs' => array(
'title' => __( 'Blog Feeds', 'buddyboss' ),
'description' => __( 'Have new blog posts and comments appear in site activity feeds. Make sure to enable Activity Feeds first.', 'buddyboss' ),
'default' => false,
)
);
// Add blogs tracking if multisite.
if ( is_multisite() ) {
$optional_components['blogs']['description'] = __( 'Record activity for new sites, posts, and comments across your network.', 'buddyboss' );
}
$default_components = array();
foreach( array_merge( $required_components, $optional_components ) as $key => $component ) {
if ( isset( $component['default'] ) && true === $component['default'] ) {
$default_components[ $key ] = $component;
}
}
switch ( $type ) {
case 'required' :
$components = $required_components;
break;
case 'optional' :
$components = $optional_components;
break;
case 'default' :
$components = $default_components;
break;
case 'all' :
default :
$components = array_merge( $required_components, $optional_components );
break;
}
/**
* Filters the list of component information.
*
* @since BuddyPress 2.6.0
*
* @param array $components Array of component information.
* @param string $type Type of component list requested.
* Possible values are 'all', 'optional', 'required'.
*/
return apply_filters( 'bp_core_get_components', $components, $type );
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 2.6.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.