Skip to:
Content

BuddyPress.org

Changeset 6584


Ignore:
Timestamp:
12/10/2012 09:02:49 AM (14 years ago)
Author:
johnjamesjacoby
Message:

First pass at contextual help pages. Props modemlooper. Fixes #4613.

File:
1 edited

Legend:

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

    r6581 r6584  
    8989
    9090        <div class="wrap">
    91                 <?php screen_icon( 'buddypress'); ?>
     91                <?php screen_icon( 'buddypress' ); ?>
    9292                <h2><?php _e( 'Why have all my BuddyPress menus disappeared?', 'buddypress' ); ?></h2>
    9393
    … …  
    9696        </div>
    9797
    98 <?php
     98        <?php
    9999}
    100100
    … …  
    127127        // Show the messages
    128128        if ( !empty( $bp->admin->notices ) ) {
    129         ?>
     129                ?>
    130130                <div id="message" class="updated fade">
    131                         <?php foreach( $bp->admin->notices as $notice ) : ?>
     131                <?php foreach ( $bp->admin->notices as $notice ) : ?>
    132132                                <p><?php echo $notice ?></p>
    133                         <?php endforeach ?>
     133                <?php endforeach ?>
    134134                </div>
    135         <?php
     135                <?php
    136136        }
    137137}
    … …  
    180180
    181181        // Bail if no activation redirect
    182     if ( ! get_transient( '_bp_activation_redirect' ) )
     182        if ( ! get_transient( '_bp_activation_redirect' ) )
    183183                return;
    184184
    … …  
    212212        $tabs = array(
    213213                '0' => array(
    214                         'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components'    ), 'admin.php' ) ),
     214                        'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), 'admin.php' ) ),
    215215                        'name' => __( 'Components', 'buddypress' )
    216216                ),
    … …  
    220220                ),
    221221                '2' => array(
    222                         'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings'      ), 'admin.php' ) ),
    223                         'name' => __( 'Settings',   'buddypress' )
     222                        'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings' ), 'admin.php' ) ),
     223                        'name' => __( 'Settings', 'buddypress' )
    224224                )
    225225        );
    226226
    227227        // Loop through tabs and build navigation
    228         foreach( array_values( $tabs ) as $tab_data ) {
     228        foreach ( array_values( $tabs ) as $tab_data ) {
    229229                $is_current = (bool) ( $tab_data['name'] == $active_tab );
    230230                $tab_class  = $is_current ? $active_class : $idle_class;
    … …  
    238238        do_action( 'bp_admin_tabs' );
    239239}
     240
     241/** Help **********************************************************************/
     242
     243/**
     244 * adds contextual help to BuddyPress admin pages
     245 *
     246 * @since BuddyPress (1.7)
     247 * @todo Make this part of the BP_Component class and split into each component
     248 */
     249function bp_core_add_contextual_help( $screen = '' ) {
     250
     251        $screen = get_current_screen();
     252
     253        switch ( $screen->id ) {
     254
     255                // Compontent page
     256                case 'settings_page_bp-components' :
     257
     258                        // help tabs
     259                        $screen->add_help_tab( array(
     260                                'id'      => 'bp-comp-overview',
     261                                'title'   => __( 'Overview' ),
     262                                'content' => bp_core_add_contextual_help_content( 'bp-comp-overview' ),
     263                        ) );
     264
     265                        // help panel - sidebar links
     266                        $screen->set_help_sidebar(
     267                                '<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .
     268                                '<p>' . __( '<a href="http://codex.buddypress.org/getting-started/configure-buddypress-components/#settings-buddypress-components">Managing Components</a>', 'buddypress' ) . '</p>' .
     269                                '<p>' . __( '<a href="http://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>'
     270                        );
     271                        break;
     272
     273                // Pages page
     274                case 'settings_page_bp-page-settings' :
     275
     276                        // Help tabs
     277                        $screen->add_help_tab( array(
     278                                'id' => 'bp-page-overview',
     279                                'title' => __( 'Overview' ),
     280                                'content' => bp_core_add_contextual_help_content( 'bp-page-overview' ),
     281                        ) );
     282
     283                        // Help panel - sidebar links
     284                        $screen->set_help_sidebar(
     285                                '<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .
     286                                '<p>' . __( '<a href="http://codex.buddypress.org/getting-started/configure-buddypress-components/#settings-buddypress-pages">Managing Pages</a>', 'buddypress' ) . '</p>' .
     287                                '<p>' . __( '<a href="http://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>'
     288                        );
     289
     290                        break;
     291
     292                // Settings page
     293                case 'settings_page_bp-settings' :
     294
     295                        // Help tabs
     296                        $screen->add_help_tab( array(
     297                                'id'      => 'bp-settings-overview',
     298                                'title'   => __( 'Overview' ),
     299                                'content' => bp_core_add_contextual_help_content( 'bp-settings-overview' ),
     300                        ) );
     301
     302                        // Help panel - sidebar links
     303                        $screen->set_help_sidebar(
     304                                '<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .
     305                                '<p>' . __( '<a href="http://codex.buddypress.org/getting-started/configure-buddypress-components/#settings-buddypress-settings">Managing Settings</a>', 'buddypress' ) . '</p>' .
     306                                '<p>' . __( '<a href="http://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>'
     307                        );
     308
     309                        break;
     310
     311                // Profile fields page
     312                case 'users_page_bp-profile-overview' :
     313
     314                        // Help tabs
     315                        $screen->add_help_tab( array(
     316                                'id'      => 'bp-profile-overview',
     317                                'title'   => __( 'Overview' ),
     318                                'content' => bp_core_add_contextual_help_content( 'bp-profile-overview' ),
     319                        ) );
     320
     321                        // Help panel - sidebar links
     322                        $screen->set_help_sidebar(
     323                                '<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .
     324                                '<p>' . __( '<a href="http://codex.buddypress.org/getting-started/configure-buddypress-components/#users-profile-fields">Managing Profile Fields</a>', 'buddypress' ) . '</p>' .
     325                                '<p>' . __( '<a href="http://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>'
     326                        );
     327
     328                        break;
     329        }
     330}
     331add_action( 'contextual_help', 'bp_core_add_contextual_help' );
     332
     333/**
     334 * renders contextual help content to contextual help tabs
     335 *
     336 * @since BuddyPress (1.7)
     337 */
     338function bp_core_add_contextual_help_content( $tab = '' ) {
     339
     340        switch ( $tab ) {
     341                case 'bp-comp-overview' :
     342                        return '<p>' . __( 'By default, all BuddyPress components are enabled. You can selectively disable any of the components by using the form. Your BuddyPress installation will continue to function. However, the features of the disabled components will no longer be accessible to anyone using the site.', 'buddypress' ) . '</p>';
     343                        break;
     344
     345                case'bp-page-overview' :
     346                        return '<p>' . __( 'BuddyPress Components use WordPress Pages for their root directory/archive pages. Here you can change the page associations for each active component.', 'buddypress' ) . '</p>';
     347                        break;
     348
     349                case 'bp-settings-overview' :
     350                        return '<p>' . __( 'Extra configuration settings.', 'buddypress' ) . '</p>';
     351                        break;
     352
     353                case 'bp-profile-overview' :
     354                        return '<p>' . __( 'Your users will distinguish themselves through their profile page. Create relevant profile fields that will show on each users profile.</br></br>Note: Any fields in the first group will appear on the signup page.', 'buddypress' ) . '</p>';
     355                        break;
     356
     357                default:
     358                        return false;
     359                        break;
     360        }
     361}
Note: See TracChangeset for help on using the changeset viewer.