Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/10/2012 07:43:33 PM (13 years ago)
Author:
boonebgorges
Message:

When auto-migrating options in bp_core_get_root_options(), don't overwrite option values that are found on the first pass. Fixes #4139

File:
1 edited

Legend:

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

    r5927 r5976  
    322322        $root_blog_options_meta = array_merge( $root_blog_options_meta, $network_options_meta );
    323323    }
    324 
     324   
    325325    // Missing some options, so do some one-time fixing
    326326    if ( empty( $root_blog_options_meta ) || ( count( $root_blog_options_meta ) < count( $root_blog_option_keys ) ) ) {
     327
     328        // Get a list of the keys that are already populated
     329        $existing_options = array();
     330        foreach( $root_blog_options_meta as $already_option ) {
     331            $existing_options[$already_option->name] = $already_option->value;
     332        }
    327333
    328334        // Unset the query - We'll be resetting it soon
     
    334340            unset( $old_meta_value );
    335341
     342            if ( isset( $existing_options[$old_meta_key] ) ) {
     343                continue;
     344            }
     345
    336346            // Get old site option
    337347            if ( is_multisite() )
     
    348358            $root_blog_options_meta[$old_meta_key] = $old_meta_value;
    349359        }
     360       
     361        $root_blog_options_meta = array_merge( $root_blog_options_meta, $existing_options );
     362        unset( $existing_options );
    350363
    351364    // We're all matched up
Note: See TracChangeset for help on using the changeset viewer.