Skip to:
Content

bbPress.org

Changeset 4968


Ignore:
Timestamp:
05/28/2013 09:58:32 PM (13 years ago)
Author:
johnjamesjacoby
Message:

Split "Main" settings up into "User" and "Features" - also tweak fancy editor verbiage to add more context.

Location:
trunk/includes/admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/admin/admin.php

    r4961 r4968  
    409409            case 'bbp_tools_reset_page'      : // Tools - Reset Page
    410410            case 'bbp_settings_page'         : // Settings Page
    411             case 'bbp_settings_main'         : // Settings - General
     411            case 'bbp_settings_user'         : // Settings - Users
     412            case 'bbp_settings_features'     : // Settings - Features
    412413            case 'bbp_settings_theme_compat' : // Settings - Theme compat
    413414            case 'bbp_settings_root_slugs'   : // Settings - Root slugs
  • trunk/includes/admin/settings.php

    r4967 r4968  
    2121function bbp_admin_get_settings_sections() {
    2222    return (array) apply_filters( 'bbp_admin_get_settings_sections', array(
    23         'bbp_settings_main' => array(
    24             'title'    => __( 'Main Forum Settings', 'bbpress' ),
    25             'callback' => 'bbp_admin_setting_callback_main_section',
     23        'bbp_settings_user' => array(
     24            'title'    => __( 'Forum User Settings', 'bbpress' ),
     25            'callback' => 'bbp_admin_setting_callback_user_section',
     26            'page'     => 'discussion'
     27        ),
     28        'bbp_settings_features' => array(
     29            'title'    => __( 'Forum Features', 'bbpress' ),
     30            'callback' => 'bbp_admin_setting_callback_features_section',
    2631            'page'     => 'discussion'
    2732        ),
     
    7883    return (array) apply_filters( 'bbp_admin_get_settings_fields', array(
    7984
    80         /** Main Section ******************************************************/
    81 
    82         'bbp_settings_main' => array(
     85        /** User Section ******************************************************/
     86
     87        'bbp_settings_user' => array(
    8388
    8489            // Edit lock setting
     
    98103            ),
    99104
     105            // Allow anonymous posting setting
     106            '_bbp_allow_anonymous' => array(
     107                'title'             => __( 'Anonymous posting', 'bbpress' ),
     108                'callback'          => 'bbp_admin_setting_callback_anonymous',
     109                'sanitize_callback' => 'intval',
     110                'args'              => array()
     111            ),
     112
     113            // Allow global access (on multisite)
     114            '_bbp_allow_global_access' => array(
     115                'title'             => __( 'Auto role', 'bbpress' ),
     116                'callback'          => 'bbp_admin_setting_callback_global_access',
     117                'sanitize_callback' => 'intval',
     118                'args'              => array()
     119            ),
     120
     121            // Allow global access (on multisite)
     122            '_bbp_default_role' => array(
     123                'sanitize_callback' => 'sanitize_text_field',
     124                'args'              => array()
     125            )
     126        ),
     127
     128        /** Features Section **************************************************/
     129
     130        'bbp_settings_features' => array(
     131
    100132            // Allow topic and reply revisions
    101133            '_bbp_allow_revisions' => array(
     
    130162            ),
    131163
    132             // Allow anonymous posting setting
    133             '_bbp_allow_anonymous' => array(
    134                 'title'             => __( 'Anonymous posting', 'bbpress' ),
    135                 'callback'          => 'bbp_admin_setting_callback_anonymous',
    136                 'sanitize_callback' => 'intval',
    137                 'args'              => array()
    138             ),
    139 
    140             // Allow global access (on multisite)
    141             '_bbp_default_role' => array(
    142                 'sanitize_callback' => 'sanitize_text_field',
    143                 'args'              => array()
    144             ),
    145 
    146             // Allow global access (on multisite)
    147             '_bbp_allow_global_access' => array(
    148                 'title'             => __( 'Auto role', 'bbpress' ),
    149                 'callback'          => 'bbp_admin_setting_callback_global_access',
    150                 'sanitize_callback' => 'intval',
    151                 'args'              => array()
    152             ),
    153 
    154164            // Allow fancy editor setting
    155165            '_bbp_use_wp_editor' => array(
    156                 'title'             => __( 'Fancy editor', 'bbpress' ),
     166                'title'             => __( 'Post Formatting', 'bbpress' ),
    157167                'callback'          => 'bbp_admin_setting_callback_use_wp_editor',
    158168                'args'              => array(),
     
    420430}
    421431
    422 /** Main Section **************************************************************/
    423 
    424 /**
    425  * Main settings section description for the settings page
    426  *
    427  * @since bbPress (r2786)
    428  */
    429 function bbp_admin_setting_callback_main_section() {
    430 ?>
    431 
    432     <p><?php esc_html_e( 'Main forum settings for enabling features and setting time limits', 'bbpress' ); ?></p>
    433 
    434 <?php
    435 }
     432/** User Section **************************************************************/
     433
     434/**
     435 * User settings section description for the settings page
     436 *
     437 * @since bbPress (r2786)
     438 */
     439function bbp_admin_setting_callback_user_section() {
     440?>
     441
     442    <p><?php esc_html_e( 'Setting time limits and other user posting capabilities', 'bbpress' ); ?></p>
     443
     444<?php
     445}
     446
    436447
    437448/**
     
    463474    <input name="_bbp_throttle_time" type="number" min="0" step="1" id="_bbp_throttle_time" value="<?php bbp_form_option( '_bbp_throttle_time', '10' ); ?>" class="small-text"<?php bbp_maybe_admin_setting_disabled( '_bbp_throttle_time' ); ?> />
    464475    <label for="_bbp_throttle_time"><?php esc_html_e( 'seconds', 'bbpress' ); ?></label>
     476
     477<?php
     478}
     479
     480/**
     481 * Allow anonymous posting setting field
     482 *
     483 * @since bbPress (r2737)
     484 *
     485 * @uses checked() To display the checked attribute
     486 */
     487function bbp_admin_setting_callback_anonymous() {
     488?>
     489
     490    <input id="_bbp_allow_anonymous" name="_bbp_allow_anonymous" type="checkbox" id="_bbp_allow_anonymous" value="1" <?php checked( bbp_allow_anonymous( false ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_anonymous' ); ?> />
     491    <label for="_bbp_allow_anonymous"><?php esc_html_e( 'Allow guest users without accounts to create topics and replies', 'bbpress' ); ?></label>
     492
     493<?php
     494}
     495
     496/**
     497 * Allow global access setting field
     498 *
     499 * @since bbPress (r3378)
     500 *
     501 * @uses checked() To display the checked attribute
     502 */
     503function bbp_admin_setting_callback_global_access() {
     504
     505    // Get the default role once rather than loop repeatedly below
     506    $default_role = bbp_get_default_role();
     507
     508    // Start the output buffer for the select dropdown
     509    ob_start(); ?>
     510
     511    <select name="_bbp_default_role" id="_bbp_default_role" <?php bbp_maybe_admin_setting_disabled( '_bbp_default_role' ); ?>>
     512
     513        <?php foreach ( bbp_get_dynamic_roles() as $role => $details ) : ?>
     514
     515            <option <?php selected( $default_role, $role ); ?> value="<?php echo esc_attr( $role ); ?>"><?php echo translate_user_role( $details['name'] ); ?></option>
     516
     517        <?php endforeach; ?>
     518
     519    </select>
     520
     521    <?php $select = ob_get_clean(); ?>
     522
     523    <label for="_bbp_allow_global_access">
     524        <input id="_bbp_allow_global_access" name="_bbp_allow_global_access" type="checkbox" id="_bbp_allow_global_access" value="1" <?php checked( bbp_allow_global_access( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_global_access' ); ?> />
     525        <?php printf( esc_html__( 'Automatically give registered visitors the %s forum role', 'bbpress' ), $select ); ?>
     526    </label>
     527
     528<?php
     529}
     530
     531/** Features Section **********************************************************/
     532
     533/**
     534 * Features settings section description for the settings page
     535 *
     536 * @since bbPress (r2786)
     537 */
     538function bbp_admin_setting_callback_features_section() {
     539?>
     540
     541    <p><?php esc_html_e( 'Forum features that can be toggled on and off', 'bbpress' ); ?></p>
    465542
    466543<?php
     
    570647
    571648/**
    572  * Allow anonymous posting setting field
    573  *
    574  * @since bbPress (r2737)
     649 * Use the WordPress editor setting field
     650 *
     651 * @since bbPress (r3586)
    575652 *
    576653 * @uses checked() To display the checked attribute
    577654 */
    578 function bbp_admin_setting_callback_anonymous() {
    579 ?>
    580 
    581     <input id="_bbp_allow_anonymous" name="_bbp_allow_anonymous" type="checkbox" id="_bbp_allow_anonymous" value="1" <?php checked( bbp_allow_anonymous( false ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_anonymous' ); ?> />
    582     <label for="_bbp_allow_anonymous"><?php esc_html_e( 'Allow guest users without accounts to create topics and replies', 'bbpress' ); ?></label>
    583 
    584 <?php
    585 }
    586 
    587 /**
    588  * Allow global access setting field
    589  *
    590  * @since bbPress (r3378)
    591  *
    592  * @uses checked() To display the checked attribute
    593  */
    594 function bbp_admin_setting_callback_global_access() {
    595 
    596     // Get the default role once rather than loop repeatedly below
    597     $default_role = bbp_get_default_role();
    598 
    599     // Start the output buffer for the select dropdown
    600     ob_start(); ?>
    601 
    602     <select name="_bbp_default_role" id="_bbp_default_role" <?php bbp_maybe_admin_setting_disabled( '_bbp_default_role' ); ?>>
    603 
    604         <?php foreach ( bbp_get_dynamic_roles() as $role => $details ) : ?>
    605 
    606             <option <?php selected( $default_role, $role ); ?> value="<?php echo esc_attr( $role ); ?>"><?php echo translate_user_role( $details['name'] ); ?></option>
    607 
    608         <?php endforeach; ?>
    609 
    610     </select>
    611 
    612     <?php $select = ob_get_clean(); ?>
    613 
    614     <label for="_bbp_allow_global_access">
    615         <input id="_bbp_allow_global_access" name="_bbp_allow_global_access" type="checkbox" id="_bbp_allow_global_access" value="1" <?php checked( bbp_allow_global_access( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_global_access' ); ?> />
    616         <?php printf( esc_html__( 'Automatically give registered visitors the %s forum role', 'bbpress' ), $select ); ?>
    617     </label>
    618 
    619 <?php
    620 }
    621 
    622 /**
    623  * Use the WordPress editor setting field
    624  *
    625  * @since bbPress (r3586)
    626  *
    627  * @uses checked() To display the checked attribute
    628  */
    629655function bbp_admin_setting_callback_use_wp_editor() {
    630656?>
    631657
    632658    <input id="_bbp_use_wp_editor" name="_bbp_use_wp_editor" type="checkbox" id="_bbp_use_wp_editor" value="1" <?php checked( bbp_use_wp_editor( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_use_wp_editor' ); ?> />
    633     <label for="_bbp_use_wp_editor"><?php esc_html_e( 'Use the fancy WordPress editor to create and edit topics and replies', 'bbpress' ); ?></label>
     659    <label for="_bbp_use_wp_editor"><?php esc_html_e( 'Add toolbar & buttons to textareas to help with HTML formatting', 'bbpress' ); ?></label>
    634660
    635661<?php
Note: See TracChangeset for help on using the changeset viewer.