Skip to:
Content

bbPress.org

Changeset 4967


Ignore:
Timestamp:
05/28/2013 09:29:14 PM (12 years ago)
Author:
johnjamesjacoby
Message:

Consolidate global-access and default role into 1 line-item in forum settings.

File:
1 edited

Legend:

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

    r4963 r4967  
    140140            // Allow global access (on multisite)
    141141            '_bbp_default_role' => array(
    142                 'title'             => __( 'Default user role', 'bbpress' ),
    143                 'callback'          => 'bbp_admin_setting_callback_default_role',
    144142                'sanitize_callback' => 'sanitize_text_field',
    145143                'args'              => array()
     
    548546
    549547    <label for="_bbp_allow_threaded_replies">
    550         <input name="_bbp_allow_threaded_replies" type="checkbox" id="_bbp_allow_threaded_replies" value="1" <?php checked( '1', bbp_allow_threaded_replies() ); ?> />
     548        <input name="_bbp_allow_threaded_replies" type="checkbox" id="_bbp_allow_threaded_replies" value="1" <?php checked( '1', bbp_allow_threaded_replies( false ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_threaded_replies' ); ?> />
    551549        <?php printf( esc_html__( 'Enable threaded (nested) replies %s levels deep', 'bbpress' ), $select ); ?>
    552550    </label>
     
    595593 */
    596594function bbp_admin_setting_callback_global_access() {
    597 ?>
    598 
    599     <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' ); ?> />
    600     <label for="_bbp_allow_global_access"><?php esc_html_e( 'Automatically assign default role to new, registered users upon visiting the site.', 'bbpress' ); ?></label>
    601 
    602 <?php
    603 }
    604 
    605 /**
    606  * Output forum role selector (for user edit)
    607  *
    608  * @since bbPress (r4284)
    609  */
    610 function bbp_admin_setting_callback_default_role() {
    611 
    612     $default_role = bbp_get_default_role(); ?>
     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(); ?>
    613601
    614602    <select name="_bbp_default_role" id="_bbp_default_role" <?php bbp_maybe_admin_setting_disabled( '_bbp_default_role' ); ?>>
     
    622610    </select>
    623611
    624     <?php
     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
    625620}
    626621
Note: See TracChangeset for help on using the changeset viewer.