Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/17/2014 12:42:05 AM (8 years ago)
Author:
boonebgorges
Message:

Install default options at installation time and at upgrade to 2.0

When BuddyPress is installed, all basic config options should be saved to the
database, even when the setting is empty (0). This ensures that the options
will be pre-fetched by the first call to wp_load_alloptions() and stored in the
non-persistent cache, removing the necessity to make additional failed queries
to the wp_options table.

This changeset also includes logic to add missing default options to existing
default installations when upgrading to 2.0.

Fixes #5385

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-options.php

    r7893 r7904  
    8080
    8181        // Force the BuddyBar
    82         '_bp_force_buddybar'              => false
     82        '_bp_force_buddybar'              => false,
     83
     84        /** Legacy theme *********************************************/
     85
     86        // Whether to register the bp-default themes directory
     87        '_bp_retain_bp_default'           => false,
     88
     89        /** Widgets **************************************************/
     90        'widget_bp_core_login_widget'                => false,
     91        'widget_bp_core_members_widget'              => false,
     92        'widget_bp_core_whos_online_widget'          => false,
     93        'widget_bp_core_recently_active_widget'      => false,
     94        'widget_bp_groups_widget'                    => false,
     95        'widget_bp_messages_sitewide_notices_widget' => false,
    8396    );
    8497
     
    89102 * Add default options when BuddyPress is first activated.
    90103 *
    91  * Hooked to bp_activate, it is only called once when BuddyPress is activated.
    92  * This is non-destructive, so existing settings will not be overridden.
    93  *
    94  * Currently unused.
     104 * Only called once when BuddyPress is activated.
     105 * Non-destructive, so existing settings will not be overridden.
    95106 *
    96107 * @since BuddyPress (1.6.0)
     
    106117
    107118    // Add default options
    108     foreach ( $options as $key => $value )
    109         add_option( $key, $value );
     119    foreach ( $options as $key => $value ) {
     120        bp_add_option( $key, $value );
     121    }
    110122
    111123    // Allow previously activated plugins to append their own options.
Note: See TracChangeset for help on using the changeset viewer.