WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/19/2016 04:46:14 AM (3 years ago)
Author:
jeremyfelt
Message:

Multisite: Use get_network() and get_current_network_id() for current network data.

get_network() falls back to the current network when called without any arguments. Between this and get_current_network_id(), we can replace almost all instances of the global $current_site and all instances of get_current_site().

This effectively deprecates get_current_site(), something that we'll do in a future ticket.

Props flixos90.
Fixes #37414.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/network/sites.php

    r38721 r38814  
    8888        }
    8989
    90         if ( $current_site->blog_id == $id ) {
     90        if ( get_network()->site_id == $id ) {
    9191            wp_die( __( 'Sorry, you are not allowed to change the current site.' ) );
    9292        }
     
    127127
    128128            $updated_action = 'not_deleted';
    129             if ( $id != '0' && $id != $current_site->blog_id && current_user_can( 'delete_site', $id ) ) {
     129            if ( $id != '0' && $id != get_network()->site_id && current_user_can( 'delete_site', $id ) ) {
    130130                wpmu_delete_blog( $id, true );
    131131                $updated_action = 'delete';
     
    138138
    139139                foreach ( (array) $_POST['allblogs'] as $key => $val ) {
    140                     if ( $val != '0' && $val != $current_site->blog_id ) {
     140                    if ( $val != '0' && $val != get_network()->site_id ) {
    141141                        switch ( $doaction ) {
    142142                            case 'delete':
Note: See TracChangeset for help on using the changeset viewer.