Changeset 3463 for trunk/bp-loader.php
- Timestamp:
- 11/21/2010 04:06:48 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/bp-loader.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-loader.php
r3315 r3463 77 77 } 78 78 79 /** 80 * bp_core_get_site_options() 81 * 82 * BuddyPress uses site options to store configuration settings. Many of these settings are needed 83 * at run time. Instead of fetching them all and adding many initial queries to each page load, let's fetch 84 * them all in one go. 85 * 86 * @package BuddyPress Core 87 */ 88 function bp_core_get_site_options() { 89 global $bp, $wpdb; 90 91 $options = apply_filters( 'bp_core_site_options', array( 92 'bp-deactivated-components', 93 'bp-blogs-first-install', 94 'bp-disable-blog-forum-comments', 95 'bp-xprofile-base-group-name', 96 'bp-xprofile-fullname-field-name', 97 'bp-disable-profile-sync', 98 'bp-disable-avatar-uploads', 99 'bp-disable-account-deletion', 100 'bp-disable-forum-directory', 101 'bp-disable-blogforum-comments', 102 'bb-config-location', 103 'hide-loggedout-adminbar', 104 105 /* Useful WordPress settings used often */ 106 'user-avatar-default', 107 'tags_blog_id', 108 'registration', 109 'fileupload_maxk' 110 ) ); 111 112 $meta_keys = "'" . implode( "','", (array)$options ) ."'"; 113 114 if ( is_multisite() ) 115 $meta = $wpdb->get_results( "SELECT meta_key AS name, meta_value AS value FROM {$wpdb->sitemeta} WHERE meta_key IN ({$meta_keys}) AND site_id = {$wpdb->siteid}" ); 116 else 117 $meta = $wpdb->get_results( "SELECT option_name AS name, option_value AS value FROM {$wpdb->options} WHERE option_name IN ({$meta_keys})" ); 118 119 $site_options = array(); 120 if ( !empty( $meta ) ) { 121 foreach( (array)$meta as $meta_item ) 122 $site_options[$meta_item->name] = $meta_item->value; 123 } 124 125 return apply_filters( 'bp_core_get_site_options', $site_options ); 126 } 127 79 128 /* Activation Function */ 80 129 function bp_loader_activate() { … … 85 134 if ( 'bp-sn-parent' == get_blog_option( BP_ROOT_BLOG, 'template' ) && 'bp-default' == get_blog_option( BP_ROOT_BLOG, 'stylesheet' ) ) 86 135 switch_theme( 'bp-default', 'bp-default' ); 87 88 /* Install site options on activation */89 //TODO: Find where to put this back. Here is no good because bp-core.php isn't loaded on new installation.90 //bp_core_activate_site_options( array( 'bp-disable-account-deletion' => 0, 'bp-disable-avatar-uploads' => 0, 'bp-disable-blogforum-comments' => 0, 'bp-disable-forum-directory' => 0, 'bp-disable-profile-sync' => 0 ) );91 136 92 137 do_action( 'bp_loader_activate' ); … … 108 153 delete_site_option( 'bp-deactivated-components' ); 109 154 delete_site_option( 'bp-blogs-first-install' ); 110 delete_site_option( 'bp-pages' );111 155 112 156 do_action( 'bp_loader_deactivate' );
Note: See TracChangeset
for help on using the changeset viewer.