Changeset 14040
- Timestamp:
- 04/08/2010 04:15:58 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/ms.php
r14038 r14040 810 810 */ 811 811 function grant_super_admin( $user_id ) { 812 global $current_user; 813 814 if ( $current_user->ID == $user_id || !current_user_can( 'manage_network_options' ) ) 815 return; 812 do_action( 'grant_super_admin', $user_id ); 816 813 817 814 $super_admins = get_site_option( 'site_admins', array( 'admin' ) ); … … 821 818 $super_admins[] = $user->user_login; 822 819 update_site_option( 'site_admins' , $super_admins ); 820 do_action( 'granted_super_admin', $user_id ); 823 821 } 824 822 } … … 831 829 */ 832 830 function revoke_super_admin( $user_id ) { 833 global $current_user; 834 835 if ( $current_user->ID == $user_id || !current_user_can( 'manage_network_options' ) ) 836 return; 837 838 $super_admins = get_site_option( 'site_admins', array( 'admin' ) ); 839 if ( count( $super_admins ) < 2 ) 840 return; 831 do_action( 'revoke_super_admin', $user_id ); 841 832 842 833 $admin_email = get_site_option( 'admin_email' ); 843 834 844 835 $user = new WP_User( $user_id ); 845 if ( $user-> ID != $current_user->ID || $user->user_email != $admin_email ) {836 if ( $user->user_email != $admin_email ) { 846 837 foreach ( $super_admins as $key => $username ) { 847 838 if ( $username == $user->user_login ) { 848 839 unset( $super_admins[$key] ); 840 do_action( 'revoked_super_admin', $user_id ); 849 841 break; 850 842 }
Note: See TracChangeset
for help on using the changeset viewer.