WordPress.org

Make WordPress Core

Changeset 14040


Ignore:
Timestamp:
04/08/10 04:15:58 (4 years ago)
Author:
nacin
Message:

Revert [14011]. Add some actions. fixes #12109, see #12460.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/ms.php

    r14038 r14040  
    810810 */ 
    811811function 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 ); 
    816813 
    817814    $super_admins = get_site_option( 'site_admins', array( 'admin' ) ); 
     
    821818        $super_admins[] = $user->user_login; 
    822819        update_site_option( 'site_admins' , $super_admins ); 
     820        do_action( 'granted_super_admin', $user_id ); 
    823821    } 
    824822} 
     
    831829 */ 
    832830function 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 ); 
    841832 
    842833    $admin_email = get_site_option( 'admin_email' ); 
    843      
     834 
    844835    $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 ) { 
    846837        foreach ( $super_admins as $key => $username ) { 
    847838            if ( $username == $user->user_login ) { 
    848839                unset( $super_admins[$key] ); 
     840                do_action( 'revoked_super_admin', $user_id ); 
    849841                break; 
    850842            } 
Note: See TracChangeset for help on using the changeset viewer.