Changeset 3463 for trunk/bp-core.php
- Timestamp:
- 11/21/2010 04:06:48 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/bp-core.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core.php
r3451 r3463 83 83 // Set up the members id and active components entry 84 84 $bp->members->id = 'members'; 85 85 86 $bp->members->slug = $bp->pages->members->slug; 86 87 $bp->active_components[$bp->members->slug] = $bp->members->id; … … 212 213 add_action( 'bp_setup_globals', 'bp_core_define_slugs' ); 213 214 215 216 /** 217 * bp_core_get_page_meta() 218 * 219 * Fetches BP pages from the meta table, depending on setup 220 * 221 * @package BuddyPress Core Core 222 */ 223 function bp_core_get_page_meta() { 224 if ( !defined( 'BP_ENABLE_MULTIBLOG' ) && is_multisite() ) 225 $page_ids = get_blog_option( BP_ROOT_BLOG, 'bp-pages' ); 226 else 227 $page_ids = get_option( 'bp-pages' ); 228 229 return $page_ids; 230 } 231 232 /** 233 * bp_core_update_page_meta() 234 * 235 * Stores BP pages in the meta table, depending on setup 236 * 237 * @package BuddyPress Core Core 238 */ 239 function bp_core_update_page_meta( $page_ids ) { 240 if ( !defined( 'BP_ENABLE_MULTIBLOG' ) && is_multisite() ) 241 update_blog_option( BP_ROOT_BLOG, 'bp-pages', $page_ids ); 242 else 243 update_option( 'bp-pages', $page_ids ); 244 } 245 246 214 247 function bp_core_get_page_names() { 215 global $wpdb, $current_blog; 216 217 if ( defined( 'BP_ENABLE_MULTIBLOG' ) ) 218 $page_ids = get_blog_option( $current_blog->blog_id, 'bp-pages' ); 219 else 220 $page_ids = get_blog_option( BP_ROOT_BLOG, 'bp-pages' ); 248 global $wpdb; 249 250 $page_ids = bp_core_get_page_meta(); 221 251 222 252 if ( empty( $page_ids ) ) … … 633 663 * 634 664 * @package BuddyPress Core 635 * @global $current_blog WordPress global containing information and settings for the current blog being viewed.636 665 * @uses bp_core_get_userid_from_user_login() Returns the user id for the username passed 637 666 * @return The user id for the user that is currently being displayed, return zero if this is not a user home and just a normal blog. … … 1553 1582 1554 1583 return apply_filters( 'bp_core_get_site_path', $site_path ); 1555 }1556 1557 /**1558 * bp_core_get_site_options()1559 *1560 * BuddyPress uses site options to store configuration settings. Many of these settings are needed1561 * at run time. Instead of fetching them all and adding many initial queries to each page load, let's fetch1562 * them all in one go.1563 *1564 * @package BuddyPress Core1565 */1566 function bp_core_get_site_options() {1567 global $bp, $wpdb;1568 1569 $options = apply_filters( 'bp_core_site_options', array(1570 'bp-deactivated-components',1571 'bp-blogs-first-install',1572 'bp-disable-blog-forum-comments',1573 'bp-xprofile-base-group-name',1574 'bp-xprofile-fullname-field-name',1575 'bp-disable-profile-sync',1576 'bp-disable-avatar-uploads',1577 'bp-disable-account-deletion',1578 'bp-disable-forum-directory',1579 'bp-disable-blogforum-comments',1580 'bb-config-location',1581 'hide-loggedout-adminbar',1582 1583 // Useful WordPress settings used often1584 'avatar_default',1585 'tags_blog_id',1586 'registration',1587 'fileupload_maxk'1588 ) );1589 1590 $meta_keys = "'" . implode( "','", (array)$options ) ."'";1591 1592 if ( is_multisite() )1593 $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}" );1594 else1595 $meta = $wpdb->get_results( "SELECT option_name AS name, option_value AS value FROM {$wpdb->options} WHERE option_name IN ({$meta_keys})" );1596 1597 $site_options = array();1598 if ( !empty( $meta ) ) {1599 foreach( (array)$meta as $meta_item )1600 $site_options[$meta_item->name] = $meta_item->value;1601 }1602 1603 return apply_filters( 'bp_core_get_site_options', $site_options );1604 1584 } 1605 1585 … … 2164 2144 $new_page_ids[$slug] = wp_insert_post( array( 'post_title' => ucwords( $slug ), 'post_status' => 'publish', 'post_type' => 'page' ) ); 2165 2145 2166 $page_ids = get_site_option( 'bp-pages' ); 2146 $page_ids = bp_core_get_page_meta(); 2147 2167 2148 $page_ids = (array) $page_ids; 2168 2149 $page_ids = array_merge( (array) $new_page_ids, (array) $page_ids ); 2169 update_site_option( 'bp-pages', $page_ids ); 2150 2151 bp_core_update_page_meta( $page_ids ); 2170 2152 } 2171 2153 ?>
Note: See TracChangeset
for help on using the changeset viewer.