Skip to content

Commit

Permalink
Merge pull request #22 from Nomafin/patch-no-superadmins
Browse files Browse the repository at this point in the history
Fix a bug where adding superadmins would crash if none existed before
  • Loading branch information
schlessera authored Feb 21, 2019
2 parents 91cf046 + 9e19e7a commit f732d41
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions features/super-admin.feature
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,16 @@ Feature: Manage super admins associated with a multisite instance
"""
admin
"""

Scenario: Handle a site with an empty site_admins option without errors
Given a WP multisite installation

When I run `wp site option set site_admins ''`
Then STDOUT should be:
"""
Success: Updated 'site_admins' site option.
"""
And STDERR should be empty

When I run `wp super-admin list`
Then STDERR should be empty
2 changes: 1 addition & 1 deletion src/Super_Admin_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,6 @@ public function remove( $args, $_ ) {

private static function get_admins() {
// We don't use get_super_admins() because we don't want to mess with the global
return get_site_option( 'site_admins', array('admin') );
return (array) get_site_option( 'site_admins', array('admin') );
}
}

0 comments on commit f732d41

Please sign in to comment.