Skip to:
Content

BuddyPress.org

Changeset 10726


Ignore:
Timestamp:
04/29/2016 02:55:45 AM (9 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.

Location:
trunk/src/bp-core
Files:
2 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    /**
  • 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.