Skip to:
Content

Changeset 3685


Ignore:
Timestamp:
01/17/2012 11:55:00 PM (7 years ago)
Author:
johnjamesjacoby
Message:

Refactor bbp_admin_settings_help() to use add_help_tab() and set_help_sidebar(). See #1699.

Location:
branches/plugin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-admin/bbp-settings.php

    r3586 r3685  
    562562 *
    563563 * @since bbPress (r3119)
     564 * @uses get_current_screen()
    564565 */
    565566function bbp_admin_settings_help() {
    566567
    567     $bbp_contextual_help[] = __('This screen provides access to basic bbPress settings.', 'bbpress' );
    568     $bbp_contextual_help[] = __('In the Main Settings you have a number of options:',     'bbpress' );
    569     $bbp_contextual_help[] =
    570         '<ul>' .
    571             '<li>' . __( 'You can choose to lock a post after a certain number of minutes. "Locking post editing" will prevent the author from editing some amount of time after saving a post.',              'bbpress' ) . '</li>' .
    572             '<li>' . __( '"Throttle time" is the amount of time required between posts from a single author. The higher the throttle time, the longer a user will need to wait between posting to the forum.', 'bbpress' ) . '</li>' .
    573             '<li>' . __( 'You may choose to allow favorites, which are a way for users to save and later return to topics they favor. This is enabled by default.',                                            'bbpress' ) . '</li>' .
    574             '<li>' . __( 'You may choose to allow subscriptions, which allows users to subscribe for notifications to topics that interest them. This is enabled by default.',                                 'bbpress' ) . '</li>' .
    575             '<li>' . __( 'You may choose to allow "Anonymous Posting", which will allow guest users who do not have accounts on your site to both create topics as well as replies.',                          'bbpress' ) . '</li>' .
    576         '</ul>';
    577 
    578     $bbp_contextual_help[] = __( 'Per Page settings allow you to control the number of topics and replies will appear on each of those pages. This is comparable to the WordPress "Reading Settings" page, where you can set the number of posts that should show on blog pages and in feeds.', 'bbpress' );
    579     $bbp_contextual_help[] = __( 'The Forums section allows you to control the permalink structure for your forums. Each "base" is what will be displayed after your main URL and right before your permalink slug.', 'bbpress' );
    580     $bbp_contextual_help[] = __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.', 'bbpress' );
    581     $bbp_contextual_help[] = __( '<strong>For more information:</strong>', 'bbpress' );
    582     $bbp_contextual_help[] =
    583         '<ul>' .
    584             '<li>' . __( '<a href="http://bbpress.org/documentation/">bbPress Documentation</a>', 'bbpress' ) . '</li>' .
    585             '<li>' . __( '<a href="http://bbpress.org/forums/">bbPress Support Forums</a>',       'bbpress' ) . '</li>' .
    586         '</ul>' ;
    587 
    588     // Empty the default $contextual_help var
    589     $contextual_help = '';
    590 
    591     // Wrap each help item in paragraph tags
    592     foreach( $bbp_contextual_help as $paragraph )
    593         $contextual_help .= '<p>' . $paragraph . '</p>';
    594 
    595     // Add help
    596     add_contextual_help( 'settings_page_bbpress', $contextual_help );
     568    $current_screen = get_current_screen();
     569
     570    // Bail if current screen could not be found
     571    if ( empty( $current_screen ) )
     572        return;
     573
     574    // Overview
     575    $current_screen->add_help_tab( array(
     576        'id'      => 'overview',
     577        'title'   => __( 'Overview', 'bbpress' ),
     578        'content' => '<p>' . __( 'This screen provides access to all of the bbPress settings.',                         'bbpress' ) . '</p>' .
     579                     '<p>' . __( 'Please see the additional help tabs for more information on each indiviual section.', 'bbpress' ) . '</p>'
     580    ) );
     581
     582    // Main Settings
     583    $current_screen->add_help_tab( array(
     584        'id'      => 'main_settings',
     585        'title'   => __( 'Main Settings', 'bbpress' ),
     586        'content' => '<p>' . __( 'In the Main Settings you have a number of options:', 'bbpress' ) . '</p>' .
     587                     '<p>' .
     588                        '<ul>' .
     589                            '<li>' . __( 'You can choose to lock a post after a certain number of minutes. "Locking post editing" will prevent the author from editing some amount of time after saving a post.',              'bbpress' ) . '</li>' .
     590                            '<li>' . __( '"Throttle time" is the amount of time required between posts from a single author. The higher the throttle time, the longer a user will need to wait between posting to the forum.', 'bbpress' ) . '</li>' .
     591                            '<li>' . __( 'Favorites are a way for users to save and later return to topics they favor. This is enabled by default.',                                                                           'bbpress' ) . '</li>' .
     592                            '<li>' . __( 'Subscriptions allow users to subscribe for notifications to topics that interest them. This is enabled by default.',                                                                 'bbpress' ) . '</li>' .
     593                            '<li>' . __( '"Anonymous Posting" allows guest users who do not have accounts on your site to both create topics as well as replies.',                                                             'bbpress' ) . '</li>' .
     594                            '<li>' . __( 'The Fancy Editor brings the luxury of the Visual editor and HTML editor from the traditional WordPress dashboard into your theme.',                                                  'bbpress' ) . '</li>' .
     595                        '</ul>' .
     596                    '</p>' .
     597                    '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.', 'bbpress' ) . '</p>'
     598    ) );
     599
     600    // Per Page
     601    $current_screen->add_help_tab( array(
     602        'id'      => 'per_page',
     603        'title'   => __( 'Per Page', 'bbpress' ),
     604        'content' => '<p>' . __( 'Per Page settings allow you to control the number of topics and replies appear on each page.',                                                    'bbpress' ) . '</p>' .
     605                     '<p>' . __( 'This is comparable to the WordPress "Reading Settings" page, where you can set the number of posts that should show on blog pages and in feeds.', 'bbpress' ) . '</p>' .
     606                     '<p>' . __( 'These are broken up into two separate groups: one for what appears in your theme, another for RSS feeds.',                                        'bbpress' ) . '</p>'
     607    ) );
     608
     609    // Slugs
     610    $current_screen->add_help_tab( array(
     611        'id'      => 'slus',
     612        'title'   => __( 'Slugs', 'bbpress' ),
     613        'content' => '<p>' . __( 'The Slugs section allows you to control the permalink structure for your forums.',                                                                                                            'bbpress' ) . '</p>' .
     614                     '<p>' . __( '"Archive Slugs" are used as the "root" for your forums and topics. If you combine these values with existing page slugs, bbPress will attempt to output the most correct title and content.', 'bbpress' ) . '</p>' .
     615                     '<p>' . __( '"Single Slugs" are used as a prefix when viewing an individual forum, topic, reply, user, or view.',                                                                                          'bbpress' ) . '</p>' .
     616                     '<p>' . __( 'In the event of a slug collision with WordPress or BuddyPress, a warning will appear next to the problem slug(s).', 'bbpress' ) . '</p>'
     617    ) );
     618
     619    // Help Sidebar
     620    $current_screen->set_help_sidebar(
     621        '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
     622        '<p>' . __( '<a href="http://bbpress.org/documentation/" target="_blank">bbPress Documentation</a>', 'bbpress' ) . '</p>' .
     623        '<p>' . __( '<a href="http://bbpress.org/forums/" target="_blank">bbPress Support Forums</a>',       'bbpress' ) . '</p>'
     624    );
    597625}
    598626
  • branches/plugin/bbp-includes/bbp-core-hooks.php

    r3684 r3685  
    490490    add_action( 'bbp_admin_init',    'bbp_admin_topics',         9 );
    491491    add_action( 'bbp_admin_init',    'bbp_admin_replies',        9 );
    492     add_action( 'bbp_admin_init',    'bbp_admin_settings_help'     );
    493492    add_action( 'admin_menu',        'bbp_admin_separator'         );
    494493    add_action( 'custom_menu_order', 'bbp_admin_custom_menu_order' );
    495494    add_action( 'menu_order',        'bbp_admin_menu_order'        );
     495
     496    // Contextual Helpers
     497    add_action( 'load-settings_page_bbpress', 'bbp_admin_settings_help' );
    496498
    497499    /**
Note: See TracChangeset for help on using the changeset viewer.