Changeset 4968
- Timestamp:
- 05/28/2013 09:58:32 PM (13 years ago)
- Location:
- trunk/includes/admin
- Files:
-
- 2 edited
-
admin.php (modified) (1 diff)
-
settings.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/admin/admin.php
r4961 r4968 409 409 case 'bbp_tools_reset_page' : // Tools - Reset Page 410 410 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 412 413 case 'bbp_settings_theme_compat' : // Settings - Theme compat 413 414 case 'bbp_settings_root_slugs' : // Settings - Root slugs -
trunk/includes/admin/settings.php
r4967 r4968 21 21 function bbp_admin_get_settings_sections() { 22 22 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', 26 31 'page' => 'discussion' 27 32 ), … … 78 83 return (array) apply_filters( 'bbp_admin_get_settings_fields', array( 79 84 80 /** MainSection ******************************************************/81 82 'bbp_settings_ main' => array(85 /** User Section ******************************************************/ 86 87 'bbp_settings_user' => array( 83 88 84 89 // Edit lock setting … … 98 103 ), 99 104 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 100 132 // Allow topic and reply revisions 101 133 '_bbp_allow_revisions' => array( … … 130 162 ), 131 163 132 // Allow anonymous posting setting133 '_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 154 164 // Allow fancy editor setting 155 165 '_bbp_use_wp_editor' => array( 156 'title' => __( ' Fancy editor', 'bbpress' ),166 'title' => __( 'Post Formatting', 'bbpress' ), 157 167 'callback' => 'bbp_admin_setting_callback_use_wp_editor', 158 168 'args' => array(), … … 420 430 } 421 431 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 */ 439 function 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 436 447 437 448 /** … … 463 474 <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' ); ?> /> 464 475 <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 */ 487 function 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 */ 503 function 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 */ 538 function 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> 465 542 466 543 <?php … … 570 647 571 648 /** 572 * Allow anonymous postingsetting field573 * 574 * @since bbPress (r 2737)649 * Use the WordPress editor setting field 650 * 651 * @since bbPress (r3586) 575 652 * 576 653 * @uses checked() To display the checked attribute 577 654 */ 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 <?php585 }586 587 /**588 * Allow global access setting field589 *590 * @since bbPress (r3378)591 *592 * @uses checked() To display the checked attribute593 */594 function bbp_admin_setting_callback_global_access() {595 596 // Get the default role once rather than loop repeatedly below597 $default_role = bbp_get_default_role();598 599 // Start the output buffer for the select dropdown600 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 <?php620 }621 622 /**623 * Use the WordPress editor setting field624 *625 * @since bbPress (r3586)626 *627 * @uses checked() To display the checked attribute628 */629 655 function bbp_admin_setting_callback_use_wp_editor() { 630 656 ?> 631 657 632 658 <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> 634 660 635 661 <?php
Note: See TracChangeset
for help on using the changeset viewer.