Skip to content

Commit cfab041

Browse files
author
Luke Carbis
committed
Change sites arrays to WP_Site objects
1 parent 6046871 commit cfab041

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

classes/class-network.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,9 +395,9 @@ public function list_table_filters( $filters ) {
395395

396396
// add all sites
397397
foreach ( wp_stream_get_sites() as $blog ) {
398-
$blog_data = get_blog_details( $blog );
398+
$blog_data = get_blog_details( $blog->blog_id );
399399

400-
$blogs[ $blog['blog_id'] ] = array(
400+
$blogs[ $blog->blog_id ] = array(
401401
'label' => $blog_data->blogname,
402402
'disabled' => '',
403403
);

classes/class-uninstall.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ private function delete_all_options() {
137137

138138
// Delete options from each blog on network
139139
foreach ( wp_stream_get_sites() as $blog ) {
140-
$this->delete_blog_options( absint( $blog['blog_id'] ) );
140+
$this->delete_blog_options( absint( $blog->blog_id ) );
141141
}
142142
}
143143

connectors/class-connector-blogs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function get_context_labels() {
6666
$blogs = wp_stream_get_sites();
6767

6868
foreach ( $blogs as $blog ) {
69-
$blog_details = get_blog_details( $blog['blog_id'] );
69+
$blog_details = get_blog_details( $blog->blog_id );
7070
$key = sanitize_key( $blog_details->blogname );
7171
$labels[ $key ] = $blog_details->blogname;
7272
}

includes/functions.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ function wp_stream_get_sites() {
9595
if ( function_exists( 'get_sites' ) ) {
9696
$sites = get_sites();
9797
} else {
98-
$sites = wp_get_sites();
98+
$sites = array();
99+
foreach ( wp_get_sites() as $site ) {
100+
$sites = get_site( $site['blog_id'] );
101+
}
99102
}
100103

101104
return $sites;

0 commit comments

Comments
 (0)