Ticket #3219: 3219.2.patch
File 3219.2.patch, 15.1 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 { 1004 1004 require_once( WP_PLUGIN_DIR . '/buddypress/bp-core/bp-core-loader.php' ); 1005 1005 1006 1006 // Redirect to the BuddyPress dashboard 1007 $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' ) );1007 $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' ) ); 1008 1008 1009 1009 wp_redirect( $redirect ); 1010 1010 … … function bp_core_setup_wizard_init() { 1055 1055 1056 1056 $bp_wizard = new BP_Core_Setup_Wizard; 1057 1057 } 1058 add_action( is_multisite() ? 'network_admin_menu' : 'admin_menu', 'bp_core_setup_wizard_init', 7 );1058 add_action( bp_core_update_admin_hook(), 'bp_core_setup_wizard_init', 7 ); 1059 1059 1060 1060 function bp_core_install( $active_components = false ) { 1061 1061 global $wpdb; … … add_action( 'bp_admin_notices', 'bp_core_wizard_message' ); 1150 1150 // Alter thickbox screens so the entire plugin download and install 1151 1151 // interface is contained within. 1152 1152 function bp_core_wizard_thickbox() { 1153 $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' ) ); ?>1153 $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' ) ); ?> 1154 1154 1155 1155 <script type="text/javascript"> 1156 1156 jQuery('p.action-button a').attr( 'target', '' ); … … function bp_core_update_add_admin_menu() { 1200 1200 // Add a hook for css/js 1201 1201 add_action( "admin_print_styles-$hook", 'bp_core_update_add_admin_menu_styles' ); 1202 1202 } 1203 add_action( is_multisite() ? 'network_admin_menu' : 'admin_menu', 'bp_core_update_add_admin_menu', 9 );1203 add_action( bp_core_update_admin_hook(), 'bp_core_update_add_admin_menu', 9 ); 1204 1204 1205 1205 function bp_core_update_add_admin_menu_styles() { 1206 1206 if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) … … function bp_core_update_get_page_meta() { 1253 1253 return apply_filters( 'bp_core_update_get_page_meta', $blog_page_ids ); 1254 1254 } 1255 1255 1256 function bp_core_update_do_network_admin() { 1257 $do_network_admin = false; 1258 1259 if ( is_multisite() && ( !defined( 'BP_ENABLE_MULTIBLOG' ) || !BP_ENABLE_MULTIBLOG ) ) 1260 $do_network_admin = true; 1261 1262 return apply_filters( 'bp_core_do_network_admin', $do_network_admin ); 1263 } 1264 1265 function bp_core_update_admin_hook() { 1266 $hook = bp_core_update_do_network_admin() ? 'network_admin_menu' : 'admin_menu'; 1267 1268 return apply_filters( 'bp_core_admin_hook', $hook ); 1269 } 1270 1256 1271 /** 1257 1272 * Adds an admin nag about running the BP upgrade/install wizard 1258 1273 * … … function bp_core_update_nag() { 1269 1284 if ( 'admin.php' == $pagenow && ( empty( $_GET['page'] ) || 'bp-wizard' == $_GET['page'] ) ) 1270 1285 return; 1271 1286 1272 $url = is_multisite() ? network_admin_url( 'admin.php?page=bp-wizard' ) : admin_url( 'admin.php?page=bp-wizard' );1287 $url = bp_core_update_do_network_admin() ? network_admin_url( 'admin.php?page=bp-wizard' ) : admin_url( 'admin.php?page=bp-wizard' ); 1273 1288 1274 1289 switch( $bp->maintenence_mode ) { 1275 1290 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 … … function bp_core_activation_notice() { 360 378 $edit_pages_links[] = sprintf( '<a href="%1$s">%2$s</a>', admin_url( 'post.php?action=edit&post=' . $op['id'] ), $op['title'] ); 361 379 } 362 380 363 $notice = sprintf( __( 'Some of your WordPress pages are linked to BuddyPress components that have been disabled. These pages may continue to show up in your site navigation. Consider <a href="%1$s">reactivating the components</a>, or unpublishing the pages: <strong>%2$s</strong>', 'buddypress' ), network_admin_url( 'admin.php?page=bp-general-settings' ), implode( ', ', $edit_pages_links ) ); 381 $admin_url = bp_core_do_network_admin() ? network_admin_url( 'admin.php?page=bp-general-settings' ) : admin_url( 'admin.php?page=bp-general-settings' ); 382 383 $notice = sprintf( __( 'Some of your WordPress pages are linked to BuddyPress components that have been disabled. These pages may continue to show up in your site navigation. Consider <a href="%1$s">reactivating the components</a>, or unpublishing the pages: <strong>%2$s</strong>', 'buddypress' ), $admin_url, implode( ', ', $edit_pages_links ) ); 364 384 365 385 bp_core_add_admin_notice( $notice ); 366 386 } … … function bp_core_activation_notice() { 403 423 } 404 424 405 425 if ( !empty( $orphaned_components ) ) { 406 $notice = sprintf( __( 'Some BuddyPress components must be associated with WordPress pages for your site to work properly. The following components are missing their required WP pages: <strong>%1$s</strong>. Visit the <a href="%2$s">BuddyPress Components</a> panel, where you can either deactivate unused components or complete the page setup.', 'buddypress' ), implode( ', ', $orphaned_components ), network_admin_url( 'admin.php?page=bp-general-settings' ) ); 426 $admin_url = bp_core_do_network_admin() ? network_admin_url( 'admin.php?page=bp-general-settings' ) : admin_url( 'admin.php?page=bp-general-settings' ); 427 428 $notice = sprintf( __( 'Some BuddyPress components must be associated with WordPress pages for your site to work properly. The following components are missing their required WP pages: <strong>%1$s</strong>. Visit the <a href="%2$s">BuddyPress Components</a> panel, where you can either deactivate unused components or complete the page setup.', 'buddypress' ), implode( ', ', $orphaned_components ), $admin_url ); 407 429 408 430 bp_core_add_admin_notice( $notice ); 409 431 } -
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