Ticket #7227: 7227.diff
File 7227.diff, 3.7 KB (added by , 8 years ago) |
---|
-
src/bp-core/admin/bp-core-admin-schema.php
diff --git a/src/bp-core/admin/bp-core-admin-schema.php b/src/bp-core/admin/bp-core-admin-schema.php index 6f9043a..91011f3 100644
a b function bp_core_install_emails() { 518 518 } 519 519 } 520 520 521 bp_update_option( 'bp-emails-unsubscribe-salt', base64_encode( wp_generate_password( 64, true, true ) ) ); 522 521 523 /** 522 524 * Fires after BuddyPress adds the posts for its emails. 523 525 * -
src/bp-core/bp-core-options.php
diff --git a/src/bp-core/bp-core-options.php b/src/bp-core/bp-core-options.php index dac2409..c674f4e 100644
a b defined( 'ABSPATH' ) || exit; 13 13 /** 14 14 * Get the default site options and their values. 15 15 * 16 * Default values should not be set by calls to `get_option()` or `get_site_option()` due to these 17 * causing loops and load order problems with `bp_core_clear_root_options_cache()`; see #BP7227. 18 * 16 19 * @since 1.6.0 17 20 * 18 21 * @return array Filtered option names and values. … … function bp_get_default_options() { 74 77 '_bp_theme_package_id' => 'legacy', 75 78 76 79 // Email unsubscribe salt. 77 'bp-emails-unsubscribe-salt' => base64_encode( wp_generate_password( 64, true, true ) ),80 'bp-emails-unsubscribe-salt' => '', 78 81 79 82 /* Groups ************************************************************/ 80 83 … … function bp_core_get_root_options() { 411 414 $root_blog_options_meta = array_merge( $root_blog_options_meta, $network_options_meta ); 412 415 } 413 416 414 // Missing some options, so do some one-time fixing. 415 if ( empty( $root_blog_options_meta ) || ( count( $root_blog_options_meta ) < count( $root_blog_option_keys ) ) ) { 416 417 // Get a list of the keys that are already populated. 418 $existing_options = array(); 419 foreach( $root_blog_options_meta as $already_option ) { 420 $existing_options[$already_option->name] = $already_option->value; 421 } 422 423 // Unset the query - We'll be resetting it soon. 424 unset( $root_blog_options_meta ); 425 426 // Loop through options. 427 foreach ( $root_blog_options as $old_meta_key => $old_meta_default ) { 428 429 if ( isset( $existing_options[$old_meta_key] ) ) { 430 continue; 431 } 432 433 // Get old site option. 434 if ( is_multisite() ) { 435 $old_meta_value = get_site_option( $old_meta_key ); 436 } 437 438 // No site option so look in root blog. 439 if ( empty( $old_meta_value ) ) { 440 $old_meta_value = bp_get_option( $old_meta_key, $old_meta_default ); 441 } 442 443 // Update the root blog option. 444 bp_update_option( $old_meta_key, $old_meta_value ); 445 446 // Update the global array. 447 $root_blog_options_meta[$old_meta_key] = $old_meta_value; 448 449 // Clear out the value for the next time around. 450 unset( $old_meta_value ); 451 } 452 453 $root_blog_options_meta = array_merge( $root_blog_options_meta, $existing_options ); 454 unset( $existing_options ); 455 456 // We're all matched up. 457 } else { 458 // Loop through our results and make them usable. 459 foreach ( $root_blog_options_meta as $root_blog_option ) { 460 $root_blog_options[$root_blog_option->name] = $root_blog_option->value; 461 } 417 // Loop through our results and make them usable. 418 foreach ( $root_blog_options_meta as $root_blog_option ) { 419 $root_blog_options[$root_blog_option->name] = $root_blog_option->value; 420 } 462 421 463 464 422 // Copy the options no the return val. 423 $root_blog_options_meta = $root_blog_options; 465 424 466 // Clean up our temporary copy. 467 unset( $root_blog_options ); 468 } 425 // Clean up our temporary copy. 426 unset( $root_blog_options ); 469 427 470 428 wp_cache_set( 'root_blog_options', $root_blog_options_meta, 'bp' ); 471 429 }