Changeset 13419 for trunk/wp-admin/ms-edit.php
- Timestamp:
- 02/25/2010 10:11:54 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/ms-edit.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/ms-edit.php
r13379 r13419 115 115 } 116 116 117 $site_admins = explode( ' ', str_replace( ",", " ", $_POST['site_admins'] ) );118 if ( is_array( $site_admins ) ) {119 $mainblog_id = $wpdb->get_var( "SELECT blog_id FROM {$wpdb->blogs} WHERE domain='{$current_site->domain}' AND path='{$current_site->path}'" );120 if ( $mainblog_id ) {121 reset( $site_admins );122 foreach ( (array) $site_admins as $site_admin ) {123 $uid = get_user_by('login', $site_admin);124 if ( $uid )125 add_user_to_blog( $mainblog_id, $uid->ID, 'administrator' );126 }127 }128 update_site_option( 'site_admins' , $site_admins );129 }130 131 117 // Update more options here 132 118 do_action( 'update_wpmu_options' ); … … 493 479 494 480 wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'all_delete'), 'ms-users.php' ) ); 481 } elseif ( isset( $_POST[ 'add_superadmin' ] ) ) { 482 $super_admins = get_site_option( 'site_admins', array( 'admin' ) ); 483 $mainblog_id = $wpdb->get_var( "SELECT blog_id FROM {$wpdb->blogs} WHERE domain='{$current_site->domain}' AND path='{$current_site->path}'" ); 484 foreach ( (array) $_POST['allusers'] as $key => $val ) { 485 if ( $val == '' || $val == '0' ) 486 continue; 487 $user = new WP_User( $val ); 488 if ( in_array( $user->user_login, $super_admins ) ) 489 continue; 490 if ( $mainblog_id ) 491 add_user_to_blog( $mainblog_id, $user->ID, 'administrator' ); 492 $super_admins[] = $user->user_login; 493 } 494 update_site_option( 'site_admins' , $super_admins ); 495 496 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'add_superadmin' ), $_SERVER['HTTP_REFERER'] ) ); 497 } elseif ( isset( $_POST[ 'remove_superadmin' ] ) ) { 498 $super_admins = get_site_option( 'site_admins', array( 'admin' ) ); 499 foreach ( (array) $_POST['allusers'] as $key => $val ) { 500 if ( $val == '' || $val == '0' ) 501 continue; 502 $user = new WP_User( $val ); 503 foreach ( $super_admins as $key => $username ) { 504 if ( $username == $user->user_login ) { 505 unset( $super_admins[ $key ] ); 506 break; 507 } 508 } 509 } 510 update_site_option( 'site_admins' , $super_admins ); 511 512 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'remove_superadmin' ), $_SERVER['HTTP_REFERER'] ) ); 495 513 } else { 496 514 foreach ( (array) $_POST['allusers'] as $key => $val ) {
Note: See TracChangeset
for help on using the changeset viewer.