Skip to:
Content

BuddyPress.org

Changeset 7551


Ignore:
Timestamp:
11/09/2013 08:34:02 PM (11 years ago)
Author:
johnjamesjacoby
Message:

Add database upgrade routine for 1.9, to automatically activate the Notifications component. Ensures previous installations will continue to have notifications functionality. See #5148.

Location:
trunk
Files:
2 edited

Legend:

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

    r7521 r7551  
    221221            bp_update_to_1_6();
    222222        }
     223
     224        // 1.9
     225        if ( $raw_db_version < 7553 ) {
     226            bp_update_to_1_9();
     227        }
    223228    }
    224229
     
    270275
    271276/**
     277 * Add the notifications component to active components.
     278 *
     279 * Notifications was added in 1.9.0, and previous installations will already
     280 * have the core notifications API active. We need to add the new Notifications
     281 * component to the active components option to retain existing functionality.
     282 *
     283 * @since BuddyPress (1.9.0)
     284 */
     285function bp_update_to_1_9() {
     286
     287    // Setup hardcoded keys
     288    $active_components_key      = 'bp-active-components';
     289    $notifications_component_id = 'notifications';
     290
     291    // Get the active components
     292    $active_components          = bp_get_option( $active_components_key );
     293
     294    // Add notifications
     295    if ( ! in_array( $notifications_component_id, $active_components ) ) {
     296        $active_components[ $notifications_component_id ] = 1;
     297    }
     298
     299    // Update the active components option
     300    bp_update_option( $active_components_key, $active_components );
     301}
     302
     303/**
    272304 * Redirect user to BP's What's New page on first page load after activation.
    273305 *
  • trunk/bp-loader.php

    r7346 r7551  
    299299
    300300        $this->version    = '1.9-alpha-7287';
    301         $this->db_version = 6080;
     301        $this->db_version = 7553;
    302302
    303303        /** Loading ***********************************************************/
Note: See TracChangeset for help on using the changeset viewer.