Changeset 4961 for trunk/bp-core/bp-core-functions.php
- Timestamp:
- 08/10/2011 06:32:02 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-functions.php
r4933 r4961 130 130 function bp_core_get_directory_pages() { 131 131 global $wpdb, $bp; 132 132 133 133 // Set pages as standard class 134 134 $pages = new stdClass; … … 979 979 function bp_core_get_root_options() { 980 980 global $wpdb; 981 981 982 982 // These options come from the root blog options table 983 983 $root_blog_options = apply_filters( 'bp_core_site_options', array( 984 984 985 985 // BuddyPress core settings 986 986 'bp-deactivated-components' => serialize( array( ) ), … … 995 995 'bb-config-location' => ABSPATH, 996 996 'hide-loggedout-adminbar' => '0', 997 997 998 998 // Useful WordPress settings 999 999 'registration' => '0', 1000 1000 'avatar_default' => 'mysteryman' 1001 1001 ) ); 1002 1002 1003 1003 $root_blog_option_keys = array_keys( $root_blog_options ); 1004 1004 $blog_options_keys = implode( "', '", (array) $root_blog_option_keys ); 1005 1005 $blog_options_query = sprintf( "SELECT option_name AS name, option_value AS value FROM {$wpdb->options} WHERE option_name IN ('%s')", $blog_options_keys ); 1006 1006 $root_blog_options_meta = $wpdb->get_results( $blog_options_query ); 1007 1007 1008 1008 // On Multisite installations, some options must always be fetched from sitemeta 1009 1009 if ( is_multisite() ) { … … 1013 1013 'fileupload_maxk' => '1500' 1014 1014 ) ); 1015 1015 1016 1016 $network_option_keys = array_keys( $network_options ); 1017 1017 $sitemeta_options_keys = implode( "','", (array) $network_option_keys ); 1018 1018 $sitemeta_options_query = sprintf( "SELECT meta_key AS name, meta_value AS value FROM {$wpdb->sitemeta} WHERE meta_key IN ('%s')", $sitemeta_options_keys ); 1019 1019 $network_options_meta = $wpdb->get_results( $sitemeta_options_query ); 1020 1020 1021 1021 // Sitemeta comes second in the merge, so that network 'registration' value wins 1022 1022 $root_blog_options_meta = array_merge( $root_blog_options_meta, $network_options_meta ); 1023 1023 } 1024 1024 1025 1025 // Missing some options, so do some one-time fixing 1026 1026 if ( empty( $root_blog_options_meta ) || ( count( $root_blog_options_meta ) < count( $root_blog_option_keys ) ) ) { 1027 1027 1028 1028 // Unset the query - We'll be resetting it soon 1029 1029 unset( $root_blog_options_meta ); 1030 1030 1031 1031 // Loop through options 1032 1032 foreach ( $root_blog_options as $old_meta_key => $old_meta_default ) { 1033 1033 // Clear out the value from the last time around 1034 1034 unset( $old_meta_value ); 1035 1035 1036 1036 // Get old site option 1037 1037 if ( is_multisite() ) 1038 1038 $old_meta_value = get_site_option( $old_meta_key ); 1039 1039 1040 1040 // No site option so look in root blog 1041 1041 if ( empty( $old_meta_value ) ) 1042 1042 $old_meta_value = bp_get_option( $old_meta_key, $old_meta_default ); 1043 1043 1044 1044 // Update the root blog option 1045 1045 bp_update_option( $old_meta_key, $old_meta_value ); 1046 1046 1047 1047 // Update the global array 1048 1048 $root_blog_options_meta[$old_meta_key] = $old_meta_value; 1049 1049 } 1050 1050 1051 1051 // We're all matched up 1052 1052 } else { … … 1054 1054 foreach ( $root_blog_options_meta as $root_blog_option ) 1055 1055 $root_blog_options[$root_blog_option->name] = $root_blog_option->value; 1056 1056 1057 1057 // Copy the options no the return val 1058 1058 $root_blog_options_meta = $root_blog_options; 1059 1059 1060 1060 // Clean up our temporary copy 1061 1061 unset( $root_blog_options ); 1062 1062 } 1063 1063 1064 1064 return apply_filters( 'bp_core_get_root_options', $root_blog_options_meta ); 1065 1065 } … … 1091 1091 $bp->add_root[] = $slug; 1092 1092 } 1093 1093 1094 1094 // Make sure that this component is registered as requiring a top-level directory 1095 1095 if ( isset( $bp->{$slug} ) ) {
Note: See TracChangeset
for help on using the changeset viewer.