Ticket #3219: 3219.1.patch
File 3219.1.patch, 12.8 KB (added by , 14 years ago) |
---|
-
bp-core/admin/bp-core-admin.php
add_action( 'in_plugin_update_message-buddypress/bp-loader.php', 'bp_core_update 16 16 * @package BuddyPress Core 17 17 * @since {@internal Unknown}} 18 18 */ 19 function bp_core_admin_dashboard() { ?> 19 function bp_core_admin_dashboard() { 20 $base_url = bp_core_do_network_admin() ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' ); 21 22 $action = add_query_arg( array( 'page' => 'bp-general-settings' ), $base_url ); 23 ?> 20 24 <div class="wrap" id="bp-admin"> 21 25 22 26 <div id="bp-admin-header"> … … function bp_core_admin_dashboard() { ?> 26 30 27 31 <?php do_action( 'bp_admin_notices' ); ?> 28 32 29 <form action="<?php echo network_admin_url( 'admin.php?page=bp-general-settings' )?>" method="post" id="bp-admin-form">33 <form action="<?php echo $action ?>" method="post" id="bp-admin-form"> 30 34 <div id="bp-admin-content"> 31 35 <p>[TODO: All sorts of awesome things will go here. Latest plugins and themes, stats, version check, support topics, news, tips]</p> 32 36 </div> … … function bp_core_admin_component_setup_handler() { 193 197 bp_core_update_page_meta( $directory_pages ); 194 198 } 195 199 196 wp_redirect( network_admin_url( add_query_arg( array( 'page' => 'bp-general-settings', 'updated' => 'true' ), 'admin.php' ) ) ); 200 $base_url = bp_core_do_network_admin() ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' ); 201 202 wp_redirect( add_query_arg( array( 'page' => 'bp-general-settings', 'updated' => 'true' ), $base_url ) ); 197 203 } 198 204 } 199 205 add_action( 'admin_init', 'bp_core_admin_component_setup_handler' ); … … function bp_core_admin_component_options() { 356 362 function bp_core_admin_page_options() { 357 363 global $bp; 358 364 359 if ( !bp_is_root_blog() ) {360 $bp->is_switched = 1;361 switch_to_blog( BP_ROOT_BLOG );362 }363 364 365 // Get the existing WP pages 365 366 $existing_pages = bp_core_get_page_meta(); 366 367 … … function bp_core_admin_page_options() { 448 449 </table> 449 450 450 451 <?php 451 452 if ( isset( $bp->is_switched ) ) {453 restore_current_blog();454 unset( $bp->is_switched );455 }456 452 } 457 453 458 454 /** -
bp-core/admin/bp-core-update.php
class BP_Core_Setup_Wizard { 145 145 146 146 $step_count = count( $this->steps ) - 1; 147 147 $wiz_or_set = $this->current_step >= $step_count ? 'bp-general-settings' : 'bp-wizard'; 148 $form_action = is_multisite() ? network_admin_url( add_query_arg( array( 'page' => $wiz_or_set ), 'admin.php' ) ) : admin_url( add_query_arg( array( 'page' => $wiz_or_set ), 'admin.php' ) );148 $form_action = bp_core_update_do_network_admin() ? network_admin_url( add_query_arg( array( 'page' => $wiz_or_set ), 'admin.php' ) ) : admin_url( add_query_arg( array( 'page' => $wiz_or_set ), 'admin.php' ) ); 149 149 ?> 150 150 151 151 <form action="<?php echo $form_action; ?>" method="post" id="bp-admin-form"> … … class BP_Core_Setup_Wizard { 1002 1002 require_once( WP_PLUGIN_DIR . '/buddypress/bp-core/bp-core-loader.php' ); 1003 1003 1004 1004 // Redirect to the BuddyPress dashboard 1005 $redirect = is_multisite() ? add_query_arg( array( 'page' => 'bp-general-settings' ), network_admin_url( 'admin.php' ) ) : add_query_arg( array( 'page' => 'bp-general-settings' ), admin_url( 'admin.php' ) );1005 $redirect = bp_core_update_do_network_admin() ? add_query_arg( array( 'page' => 'bp-general-settings' ), network_admin_url( 'admin.php' ) ) : add_query_arg( array( 'page' => 'bp-general-settings' ), admin_url( 'admin.php' ) ); 1006 1006 1007 1007 wp_redirect( $redirect ); 1008 1008 … … function bp_core_setup_wizard_init() { 1053 1053 1054 1054 $bp_wizard = new BP_Core_Setup_Wizard; 1055 1055 } 1056 add_action( is_multisite() ? 'network_admin_menu' : 'admin_menu', 'bp_core_setup_wizard_init', 7 );1056 add_action( bp_core_update_admin_hook(), 'bp_core_setup_wizard_init', 7 ); 1057 1057 1058 1058 function bp_core_install( $active_components = false ) { 1059 1059 global $wpdb; … … add_action( 'bp_admin_notices', 'bp_core_wizard_message' ); 1147 1147 // Alter thickbox screens so the entire plugin download and install 1148 1148 // interface is contained within. 1149 1149 function bp_core_wizard_thickbox() { 1150 $form_action = is_multisite() ? network_admin_url( add_query_arg( array( 'page' => 'bp-wizard', 'updated' => '1' ), 'admin.php' ) ) : admin_url( add_query_arg( array( 'page' => 'bp-wizard', 'updated' => '1' ), 'admin.php' ) ); ?>1150 $form_action = bp_core_update_do_network_admin() ? network_admin_url( add_query_arg( array( 'page' => 'bp-wizard', 'updated' => '1' ), 'admin.php' ) ) : admin_url( add_query_arg( array( 'page' => 'bp-wizard', 'updated' => '1' ), 'admin.php' ) ); ?> 1151 1151 1152 1152 <script type="text/javascript"> 1153 1153 jQuery('p.action-button a').attr( 'target', '' ); … … function bp_core_update_add_admin_menu() { 1197 1197 // Add a hook for css/js 1198 1198 add_action( "admin_print_styles-$hook", 'bp_core_update_add_admin_menu_styles' ); 1199 1199 } 1200 add_action( is_multisite() ? 'network_admin_menu' : 'admin_menu', 'bp_core_update_add_admin_menu', 9 );1200 add_action( bp_core_update_admin_hook(), 'bp_core_update_add_admin_menu', 9 ); 1201 1201 1202 1202 function bp_core_update_add_admin_menu_styles() { 1203 1203 if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) … … function bp_core_update_get_page_meta() { 1250 1250 return apply_filters( 'bp_core_update_get_page_meta', $blog_page_ids ); 1251 1251 } 1252 1252 1253 function bp_core_update_do_network_admin() { 1254 $do_network_admin = false; 1255 1256 if ( is_multisite() && ( !defined( 'BP_ENABLE_MULTIBLOG' ) || !BP_ENABLE_MULTIBLOG ) ) 1257 $do_network_admin = true; 1258 1259 return apply_filters( 'bp_core_do_network_admin', $do_network_admin ); 1260 } 1261 1262 function bp_core_update_admin_hook() { 1263 $hook = bp_core_update_do_network_admin() ? 'network_admin_menu' : 'admin_menu'; 1264 1265 return apply_filters( 'bp_core_admin_hook', $hook ); 1266 } 1267 1253 1268 /** 1254 1269 * Adds an admin nag about running the BP upgrade/install wizard 1255 1270 * … … function bp_core_update_nag() { 1266 1281 if ( 'admin.php' == $pagenow && ( empty( $_GET['page'] ) || 'bp-wizard' == $_GET['page'] ) ) 1267 1282 return; 1268 1283 1269 $url = is_multisite() ? network_admin_url( 'admin.php?page=bp-wizard' ) : admin_url( 'admin.php?page=bp-wizard' );1284 $url = bp_core_update_do_network_admin() ? network_admin_url( 'admin.php?page=bp-wizard' ) : admin_url( 'admin.php?page=bp-wizard' ); 1270 1285 1271 1286 switch( $bp->maintenence_mode ) { 1272 1287 case 'update': -
bp-core/bp-core-functions.php
function bp_core_component_slug_from_root_slug( $root_slug ) { 159 159 return apply_filters( 'bp_core_component_slug_from_root_slug', $slug, $root_slug ); 160 160 } 161 161 162 function bp_core_do_network_admin() { 163 $do_network_admin = false; 164 165 if ( is_multisite() && ( !defined( 'BP_ENABLE_MULTIBLOG' ) || !BP_ENABLE_MULTIBLOG ) ) 166 $do_network_admin = true; 167 168 return apply_filters( 'bp_core_do_network_admin', $do_network_admin ); 169 } 170 171 function bp_core_admin_hook() { 172 $hook = bp_core_do_network_admin() ? 'network_admin_menu' : 'admin_menu'; 173 174 return apply_filters( 'bp_core_admin_hook', $hook ); 175 } 176 162 177 /** 163 178 * Initializes the wp-admin area "BuddyPress" menus and sub menus. 164 179 * … … function bp_core_component_slug_from_root_slug( $root_slug ) { 168 183 function bp_core_admin_menu_init() { 169 184 if ( !is_super_admin() ) 170 185 return false; 186 187 add_action( bp_core_admin_hook(), 'bp_core_add_admin_menu', 9 ); 171 188 172 189 require ( BP_PLUGIN_DIR . '/bp-core/admin/bp-core-admin.php' ); 173 190 } 174 add_action( is_multisite() ? 'network_admin_menu' : 'admin_menu', 'bp_core_admin_menu_init' );191 add_action( 'bp_init', 'bp_core_admin_menu_init' ); 175 192 176 193 /** 177 194 * Adds the "BuddyPress" admin submenu item to the Site Admin tab. … … function bp_core_add_admin_menu() { 202 219 foreach( $hooks as $hook ) 203 220 add_action( "admin_print_styles-$hook", 'bp_core_add_admin_menu_styles' ); 204 221 } 205 add_action( is_multisite() ? 'network_admin_menu' : 'admin_menu', 'bp_core_add_admin_menu', 9 );206 222 207 223 /** 208 224 * Print admin messages to admin_notices or network_admin_notices … … function bp_core_print_admin_notices() { 224 240 if ( !is_super_admin() ) 225 241 return; 226 242 227 // On multisite installs, don't show on the Site Admin of a non-root blog 228 if ( !bp_is_root_blog() ) 243 // On multisite installs, don't show on the Site Admin of a non-root blog, unless 244 // do_network_admin is overridden 245 if ( is_multisite() && bp_core_do_network_admin() && !bp_is_root_blog() ) 229 246 return; 230 247 231 248 // Show the messages … … function bp_core_activation_notice() { 283 300 // Only the super admin gets warnings 284 301 if ( !is_super_admin() ) 285 302 return; 286 287 // On multisite installs, don't log on a non-root blog 288 if ( !bp_is_root_blog() ) 303 304 // On multisite installs, don't load on a non-root blog, unless do_network_admin is 305 // overridden 306 if ( is_multisite() && bp_core_do_network_admin() && !bp_is_root_blog() ) 289 307 return; 290 308 291 309 // Don't show these messages during setup or upgrade -
bp-forums/bp-forums-admin.php
function bp_forums_add_admin_menu() { 10 10 $hook = add_submenu_page( 'bp-general-settings', __( 'Forums Setup', 'buddypress' ), __( 'Forums Setup', 'buddypress' ), 'manage_options', 'bb-forums-setup', "bp_forums_bbpress_admin" ); 11 11 add_action( "admin_print_styles-$hook", 'bp_core_add_admin_menu_styles' ); 12 12 } 13 add_action( is_multisite() ? 'network_admin_menu' : 'admin_menu', 'bp_forums_add_admin_menu' );13 add_action( is_multisite() && bp_core_do_network_admin() ? 'network_admin_menu' : 'admin_menu', 'bp_forums_add_admin_menu' ); 14 14 15 15 function bp_forums_bbpress_admin() { 16 global $bp; ?> 16 global $bp; 17 18 $base_url = bp_core_do_network_admin() ? network_admin_url( 'admin.php' ) : admin_url( 'admin.php' ); 19 20 $action = add_query_arg( array( 'page' => 'bb-forums-setup', 'reinstall' => '1' ), $base_url ); 21 22 ?> 17 23 18 24 <div class="wrap"> 19 25 <?php screen_icon( 'buddypress' ); ?> … … function bp_forums_bbpress_admin() { 35 41 36 42 else : ?> 37 43 38 <p><?php printf( __( 'bbPress forum integration in BuddyPress has been set up correctly. If you are having problems you can <a href="%s" title="Reinstall bbPress">re-install</a> ', 'buddypress' ), network_admin_url( 'admin.php?page=bb-forums-setup&reinstall=1' )); ?>44 <p><?php printf( __( 'bbPress forum integration in BuddyPress has been set up correctly. If you are having problems you can <a href="%s" title="Reinstall bbPress">re-install</a>.', 'buddypress' ), $action ); ?> 39 45 <p><?php _e( 'NOTE: The forums directory will only work if your bbPress tables are in the same database as your WordPress tables. If you are not using an existing bbPress install you can ignore this message.', 'buddypress' ) ?></p> 40 46 41 47 <?php endif; ?> -
bp-xprofile/bp-xprofile-buddybar.php
function xprofile_add_admin_menu() { 24 24 $hook = add_submenu_page( 'bp-general-settings', __( 'Profile Fields', 'buddypress' ), __( 'Profile Fields', 'buddypress' ), 'manage_options', 'bp-profile-setup', 'xprofile_admin' ); 25 25 add_action( "admin_print_styles-$hook", 'bp_core_add_admin_menu_styles' ); 26 26 } 27 add_action( is_multisite() ? 'network_admin_menu' : 'admin_menu', 'xprofile_add_admin_menu' );27 add_action( bp_core_admin_hook(), 'xprofile_add_admin_menu' ); 28 28 29 29 /** 30 30 * Adds an admin bar menu to any profile page providing site admin options -
bp-xprofile/bp-xprofile-cssjs.php
function xprofile_add_admin_css() { 7 7 wp_enqueue_style( 'xprofile-admin-css', BP_PLUGIN_URL . '/bp-xprofile/admin/css/admin.css', array(), BP_VERSION ); 8 8 } 9 9 } 10 add_action( is_multisite() ? 'network_admin_menu' : 'admin_menu', 'xprofile_add_admin_css' );10 add_action( bp_core_admin_hook(), 'xprofile_add_admin_css' ); 11 11 12 12 function xprofile_add_admin_js() { 13 13 if ( !empty( $_GET['page'] ) && strpos( $_GET['page'], 'bp-profile-setup' ) !== false ) { … … function xprofile_add_admin_js() { 24 24 wp_enqueue_script( 'xprofile-admin-js', BP_PLUGIN_URL . '/bp-xprofile/admin/js/admin.js', array( 'jquery', 'jquery-ui-sortable' ), BP_VERSION ); 25 25 } 26 26 } 27 add_action( is_multisite() ? 'network_admin_menu' : 'admin_menu', 'xprofile_add_admin_js', 1 );27 add_action( bp_core_admin_hook(), 'xprofile_add_admin_js', 1 ); 28 28 ?> 29 No newline at end of file