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/bp-core-functions.php

    r10723 r10726  
    23182318}
    23192319
     2320/**
     2321 * Return a list of component information.
     2322 *
     2323 * @since 2.6.0
     2324 *
     2325 * @param string $type Optional; component type to fetch. Default value is 'all', or 'optional', 'retired', 'required'.
     2326 * @return array Requested components' data.
     2327 */
     2328function bp_core_get_components( $type = 'all' ) {
     2329    $required_components = array(
     2330        'core' => array(
     2331            'title'       => __( 'BuddyPress Core', 'buddypress' ),
     2332            'description' => __( 'It&#8216;s what makes <del>time travel</del> BuddyPress possible!', 'buddypress' )
     2333        ),
     2334        'members' => array(
     2335            'title'       => __( 'Community Members', 'buddypress' ),
     2336            'description' => __( 'Everything in a BuddyPress community revolves around its members.', 'buddypress' )
     2337        ),
     2338    );
     2339
     2340    $retired_components = array(
     2341        'forums' => array(
     2342            'title'       => __( 'Group Forums', 'buddypress' ),
     2343            'description' => sprintf( __( 'BuddyPress Forums are retired. Use %s.', 'buddypress' ), '<a href="https://bbpress.org/">bbPress</a>' )
     2344        ),
     2345    );
     2346
     2347    $optional_components = array(
     2348        'xprofile' => array(
     2349            'title'       => __( 'Extended Profiles', 'buddypress' ),
     2350            'description' => __( 'Customize your community with fully editable profile fields that allow your users to describe themselves.', 'buddypress' )
     2351        ),
     2352        'settings' => array(
     2353            'title'       => __( 'Account Settings', 'buddypress' ),
     2354            'description' => __( 'Allow your users to modify their account and notification settings directly from within their profiles.', 'buddypress' )
     2355        ),
     2356        'friends'  => array(
     2357            'title'       => __( 'Friend Connections', 'buddypress' ),
     2358            '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' )
     2359        ),
     2360        'messages' => array(
     2361            'title'       => __( 'Private Messaging', 'buddypress' ),
     2362            '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' )
     2363        ),
     2364        'activity' => array(
     2365            'title'       => __( 'Activity Streams', 'buddypress' ),
     2366            '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' )
     2367        ),
     2368        'notifications' => array(
     2369            'title'       => __( 'Notifications', 'buddypress' ),
     2370            'description' => __( 'Notify members of relevant activity with a toolbar bubble and/or via email, and allow them to customize their notification settings.', 'buddypress' )
     2371        ),
     2372        'groups'   => array(
     2373            'title'       => __( 'User Groups', 'buddypress' ),
     2374            'description' => __( 'Groups allow your users to organize themselves into specific public, private or hidden sections with separate activity streams and member listings.', 'buddypress' )
     2375        ),
     2376        'forums'   => array(
     2377            'title'       => __( 'Group Forums (Legacy)', 'buddypress' ),
     2378            'description' => __( 'Group forums allow for focused, bulletin-board style conversations.', 'buddypress' )
     2379        ),
     2380        'blogs'    => array(
     2381            'title'       => __( 'Site Tracking', 'buddypress' ),
     2382            'description' => __( 'Record activity for new posts and comments from your site.', 'buddypress' )
     2383        )
     2384    );
     2385
     2386    // Add blogs tracking if multisite.
     2387    if ( is_multisite() ) {
     2388        $optional_components['blogs']['description'] = __( 'Record activity for new sites, posts, and comments across your network.', 'buddypress' );
     2389    }
     2390
     2391    switch ( $type ) {
     2392        case 'required' :
     2393            $components = $required_components;
     2394            break;
     2395        case 'optional' :
     2396            $components = $optional_components;
     2397            break;
     2398        case 'retired' :
     2399            $components = $retired_components;
     2400            break;
     2401        case 'all' :
     2402        default :
     2403            $components = array_merge( $required_components, $optional_components, $retired_components );
     2404            break;
     2405    }
     2406
     2407    /**
     2408     * Filters the list of component information.
     2409     *
     2410     * @since 2.6.0
     2411     *
     2412     * @param array  $components Array of component information.
     2413     * @param string $type       Type of component list requested.
     2414     *                           Possible values are 'all', 'optional', 'retired', 'required'.
     2415     */
     2416    return apply_filters( 'bp_core_get_components', $components, $type );
     2417}
     2418
    23202419/** Nav Menu ******************************************************************/
    23212420
Note: See TracChangeset for help on using the changeset viewer.