Ticket #2717: dudewheresmycar.patch
| File dudewheresmycar.patch, 6.8 KB (added by , 15 years ago) |
|---|
-
bp-core/admin/bp-core-upgrade.php
1 1 <?php 2 3 2 require_once( dirname( dirname( __FILE__ ) ) . '/bp-core-wpabstraction.php' ); 4 3 5 4 if ( function_exists( 'register_theme_directory') ) 6 5 register_theme_directory( WP_PLUGIN_DIR . '/buddypress/bp-themes' ); 7 6 7 /* Install site options on activation */ 8 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 ) ); 9 10 /** 11 * bp_core_activate_site_options() 12 * 13 * When switching from single to multisite we need to copy blog options to 14 * site options. 15 * 16 * @package BuddyPress Core 17 */ 18 function bp_core_activate_site_options( $keys = array() ) { 19 global $bp; 20 21 $bp->site_options = bp_core_get_site_options(); 22 23 if ( !empty( $keys ) && is_array( $keys ) ) { 24 $errors = false; 25 26 foreach ( $keys as $key => $default ) { 27 if ( empty( $bp->site_options[ $key ] ) ) { 28 $bp->site_options[ $key ] = get_blog_option( BP_ROOT_BLOG, $key, $default ); 29 30 if ( !update_site_option( $key, $bp->site_options[ $key ] ) ) 31 $errors = true; 32 } 33 } 34 35 if ( empty( $errors ) ) 36 return true; 37 } 38 39 return false; 40 } 41 8 42 class BP_Core_Setup_Wizard { 9 43 var $current_step; 10 44 var $steps; … … 1085 1119 </style> 1086 1120 <?php 1087 1121 } 1088 1089 1122 ?> 1090 No newline at end of file -
bp-loader.php
76 76 do_action( 'bp_loaded' ); 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() { 130 global $bp; 131 81 132 /* Force refresh theme roots. */ 82 133 delete_site_transient( 'theme_roots' ); 83 134 … … 85 136 if ( 'bp-sn-parent' == get_blog_option( BP_ROOT_BLOG, 'template' ) && 'bp-default' == get_blog_option( BP_ROOT_BLOG, 'stylesheet' ) ) 86 137 switch_theme( 'bp-default', 'bp-default' ); 87 138 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 92 139 do_action( 'bp_loader_activate' ); 93 140 } 94 141 register_activation_hook( 'buddypress/bp-loader.php', 'bp_loader_activate' ); -
bp-core.php
1552 1552 } 1553 1553 1554 1554 /** 1555 * bp_core_get_site_options()1556 *1557 * BuddyPress uses site options to store configuration settings. Many of these settings are needed1558 * at run time. Instead of fetching them all and adding many initial queries to each page load, let's fetch1559 * them all in one go.1560 *1561 * @package BuddyPress Core1562 */1563 function bp_core_get_site_options() {1564 global $bp, $wpdb;1565 1566 $options = apply_filters( 'bp_core_site_options', array(1567 'bp-deactivated-components',1568 'bp-blogs-first-install',1569 'bp-disable-blog-forum-comments',1570 'bp-xprofile-base-group-name',1571 'bp-xprofile-fullname-field-name',1572 'bp-disable-profile-sync',1573 'bp-disable-avatar-uploads',1574 'bp-disable-account-deletion',1575 'bp-disable-forum-directory',1576 'bp-disable-blogforum-comments',1577 'bb-config-location',1578 'hide-loggedout-adminbar',1579 1580 /* Useful WordPress settings used often */1581 'user-avatar-default',1582 'tags_blog_id',1583 'registration',1584 'fileupload_maxk'1585 ) );1586 1587 $meta_keys = "'" . implode( "','", (array)$options ) ."'";1588 1589 if ( is_multisite() )1590 $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}" );1591 else1592 $meta = $wpdb->get_results( "SELECT option_name AS name, option_value AS value FROM {$wpdb->options} WHERE option_name IN ({$meta_keys})" );1593 1594 $site_options = array();1595 if ( !empty( $meta ) ) {1596 foreach( (array)$meta as $meta_item )1597 $site_options[$meta_item->name] = $meta_item->value;1598 }1599 1600 return apply_filters( 'bp_core_get_site_options', $site_options );1601 }1602 1603 /**1604 1555 * bp_core_redirect() 1605 1556 * 1606 1557 * Performs a status safe wp_redirect() that is compatible with bp_catch_uri() … … 1994 1945 } 1995 1946 add_action( 'admin_notices', 'bp_core_activation_notice' ); 1996 1947 1997 /**1998 * bp_core_activate_site_options()1999 *2000 * When switching from single to multisite we need to copy blog options to2001 * site options.2002 *2003 * @package BuddyPress Core2004 */2005 function bp_core_activate_site_options( $keys = array() ) {2006 global $bp;2007 1948 2008 if ( !empty( $keys ) && is_array( $keys ) ) {2009 $errors = false;2010 2011 foreach ( $keys as $key => $default ) {2012 if ( empty( $bp->site_options[ $key ] ) ) {2013 $bp->site_options[ $key ] = get_blog_option( BP_ROOT_BLOG, $key, $default );2014 2015 if ( !update_site_option( $key, $bp->site_options[ $key ] ) )2016 $errors = true;2017 }2018 }2019 2020 if ( empty( $errors ) )2021 return true;2022 }2023 2024 return false;2025 }2026 2027 1949 /******************************************************************************** 2028 1950 * Custom Actions 2029 1951 *