Skip to:
Content

bbPress.org


Ignore:
Timestamp:
05/19/2017 04:52:16 PM (9 years ago)
Author:
johnjamesjacoby
Message:

Settings: General improvements:

  • Use escaped equivalent for gettext output
  • Update settings-integration away from bool to allow future flexibility
  • Stash settings fields in a static variable to speed up registration
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/core/options.php

    r6323 r6419  
    4848                '_bbp_theme_package_id'       => 'default',                  // The ID for the current theme package
    4949                '_bbp_default_role'           => bbp_get_participant_role(), // Default forums role
    50                 '_bbp_settings_integration'   => 0,                          // Put settings into existing admin pages
     50                '_bbp_settings_integration'   => 'basic',                    // How to integrate into wp-admin
    5151
    5252                /** Per Page **********************************************************/
     
    479479 * Integrate settings into existing WordPress pages
    480480 *
     481 * There are 3 possible modes:
     482 * - 'basic'   Traditional admin integration
     483 * - 'compact' One "bbPress" top-level admin menu
     484 * - 'deep'    Deeply integrate with the WordPress admin interface
     485 *
    481486 * @since 2.4.0 bbPress (r4932)
    482487 *
     
    485490 * @return bool To deeply integrate settings, or not
    486491 */
    487 function bbp_settings_integration( $default = 0 ) {
    488         return (bool) apply_filters( 'bbp_settings_integration', (bool) get_option( '_bbp_settings_integration', $default ) );
     492function bbp_settings_integration( $default = 'basic' ) {
     493
     494        // Get the option value
     495        $integration = get_option( '_bbp_settings_integration', $default );
     496
     497        // Back-compat for deep/basic (pre-2.6)
     498        if ( is_numeric( $integration ) ) {
     499                $integration = ( 1 === (int) $integration )
     500                        ? 'deep'
     501                        : 'basic';
     502        }
     503
     504        // Fallback to 'none' if invalid
     505        if ( ! in_array( $integration, array( 'basic', 'deep', 'compact' ), true ) ) {
     506                $integration = 'basic';
     507        }
     508
     509        // Filter & return
     510        return apply_filters( 'bbp_settings_integration', $integration, $default );
    489511}
    490512
Note: See TracChangeset for help on using the changeset viewer.