Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/29/2016 02:55:45 AM (8 years ago)
Author:
djpaul
Message:

Create new bp_core_get_components function based on bp_core_admin_get_components.

The function contains useful information about BuddyPress' available components, but the latter is only available inside a wp-admin context.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/admin/bp-core-admin-components.php

    r10708 r10726  
    341341
    342342/**
    343  * Return a list of component information, optionally filtered by type.
     343 * Return a list of component information.
    344344 *
    345345 * We use this information both to build the markup for the admin screens, as
     
    348348 * @since 1.7.0
    349349 *
    350  * @param string $type 'all', 'optional', 'retired', 'required'.
    351  * @return array An array of requested component data.
     350 * @param string $type Optional; component type to fetch. Default value is 'all', or 'optional', 'retired', 'required'.
     351 * @return array Requested components' data.
    352352 */
    353353function bp_core_admin_get_components( $type = 'all' ) {
    354 
    355     // Required components.
    356     $required_components = array(
    357         'core' => array(
    358             'title'       => __( 'BuddyPress Core', 'buddypress' ),
    359             'description' => __( 'It&#8216;s what makes <del>time travel</del> BuddyPress possible!', 'buddypress' )
    360         ),
    361         'members' => array(
    362             'title'       => __( 'Community Members', 'buddypress' ),
    363             'description' => __( 'Everything in a BuddyPress community revolves around its members.', 'buddypress' )
    364         ),
    365     );
    366 
    367     // Retired components.
    368     $retired_components = array(
    369         'forums' => array(
    370             'title'       => __( 'Group Forums', 'buddypress' ),
    371             'description' => sprintf( __( 'BuddyPress Forums are retired. Use %s.', 'buddypress' ), '<a href="https://bbpress.org/">bbPress</a>' )
    372         ),
    373     );
    374 
    375     // Optional core components.
    376     $optional_components = array(
    377         'xprofile' => array(
    378             'title'       => __( 'Extended Profiles', 'buddypress' ),
    379             'description' => __( 'Customize your community with fully editable profile fields that allow your users to describe themselves.', 'buddypress' )
    380         ),
    381         'settings' => array(
    382             'title'       => __( 'Account Settings', 'buddypress' ),
    383             'description' => __( 'Allow your users to modify their account and notification settings directly from within their profiles.', 'buddypress' )
    384         ),
    385         'friends'  => array(
    386             'title'       => __( 'Friend Connections', 'buddypress' ),
    387             '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' )
    388         ),
    389         'messages' => array(
    390             'title'       => __( 'Private Messaging', 'buddypress' ),
    391             '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' )
    392         ),
    393         'activity' => array(
    394             'title'       => __( 'Activity Streams', 'buddypress' ),
    395             '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' )
    396         ),
    397         'notifications' => array(
    398             'title'       => __( 'Notifications', 'buddypress' ),
    399             'description' => __( 'Notify members of relevant activity with a toolbar bubble and/or via email, and allow them to customize their notification settings.', 'buddypress' )
    400         ),
    401         'groups'   => array(
    402             'title'       => __( 'User Groups', 'buddypress' ),
    403             'description' => __( 'Groups allow your users to organize themselves into specific public, private or hidden sections with separate activity streams and member listings.', 'buddypress' )
    404         ),
    405         'forums'   => array(
    406             'title'       => __( 'Group Forums (Legacy)', 'buddypress' ),
    407             'description' => __( 'Group forums allow for focused, bulletin-board style conversations.', 'buddypress' )
    408         ),
    409         'blogs'    => array(
    410             'title'       => __( 'Site Tracking', 'buddypress' ),
    411             'description' => __( 'Record activity for new posts and comments from your site.', 'buddypress' )
    412         )
    413     );
    414 
    415 
    416     // Add blogs tracking if multisite.
    417     if ( is_multisite() ) {
    418         $optional_components['blogs']['description'] = __( 'Record activity for new sites, posts, and comments across your network.', 'buddypress' );
    419     }
    420 
    421     switch ( $type ) {
    422         case 'required' :
    423             $components = $required_components;
    424             break;
    425         case 'optional' :
    426             $components = $optional_components;
    427             break;
    428         case 'retired' :
    429             $components = $retired_components;
    430             break;
    431         case 'all' :
    432         default :
    433             $components = array_merge( $required_components, $optional_components, $retired_components );
    434             break;
    435 
    436     }
     354    $components = bp_core_get_components( $type );
    437355
    438356    /**
Note: See TracChangeset for help on using the changeset viewer.