Skip to content

Commit

Permalink
Change sites arrays to WP_Site objects
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Carbis committed Jun 14, 2016
1 parent 6046871 commit cfab041
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions classes/class-network.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,9 @@ public function list_table_filters( $filters ) {

// add all sites
foreach ( wp_stream_get_sites() as $blog ) {
$blog_data = get_blog_details( $blog );
$blog_data = get_blog_details( $blog->blog_id );

$blogs[ $blog['blog_id'] ] = array(
$blogs[ $blog->blog_id ] = array(
'label' => $blog_data->blogname,
'disabled' => '',
);
Expand Down
2 changes: 1 addition & 1 deletion classes/class-uninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private function delete_all_options() {

// Delete options from each blog on network
foreach ( wp_stream_get_sites() as $blog ) {
$this->delete_blog_options( absint( $blog['blog_id'] ) );
$this->delete_blog_options( absint( $blog->blog_id ) );
}
}

Expand Down
2 changes: 1 addition & 1 deletion connectors/class-connector-blogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function get_context_labels() {
$blogs = wp_stream_get_sites();

foreach ( $blogs as $blog ) {
$blog_details = get_blog_details( $blog['blog_id'] );
$blog_details = get_blog_details( $blog->blog_id );
$key = sanitize_key( $blog_details->blogname );
$labels[ $key ] = $blog_details->blogname;
}
Expand Down
5 changes: 4 additions & 1 deletion includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ function wp_stream_get_sites() {
if ( function_exists( 'get_sites' ) ) {
$sites = get_sites();
} else {
$sites = wp_get_sites();
$sites = array();
foreach ( wp_get_sites() as $site ) {
$sites = get_site( $site['blog_id'] );
}
}

return $sites;
Expand Down

0 comments on commit cfab041

Please sign in to comment.