Make WordPress Core

Opened 9 years ago

Last modified 4 weeks ago

#43390 new defect (bug)

get_super_admins() should not return "admin" by default

Reported by: thomaswm Owned by:
Priority: normal Milestone: Awaiting Review
Component: Networks and Sites Version: 3.0
Severity: normal Keywords: has-patch
Cc: Focuses: multisite

Description

The function get_super_admins(), introduced in [14206], returns an array of users with network admin capabilities. Those are stored in the site_admins network option.

If, for any reason, that network option does not exist, get_super_admins() will return a one-element array containing "admin" instead.

See line 761 in wp-includes/capabilities.php.

return get_site_option( 'site_admins', array('admin') );

This goes back to a time when admin was the default username for the first WordPress user. Since administrators are now discouraged from using admin as a username, get_super_admins() should return an empty array by default:

return get_site_option( 'site_admins', array() );

Attachments (1)

43390.diff (1.2 KB ) - added by thomaswm 9 years ago.
Patch

Download all attachments as: .zip

Change History (11)

#1 @thomaswm
9 years ago

Just realized that grant_super_admin() and revoke_super_admin() are also affected.

Lines 820 and 867 in wp-includes/capabilities.php both read:

$super_admins = get_site_option( 'site_admins', array( 'admin' ) );

#3 @thomaswm
9 years ago

  • Version3.0

@thomaswm
9 years ago

Patch

#4 @thomaswm
9 years ago

  • Keywords has-patch added

This ticket was mentioned in Slack in #core-multisite by realloc. View the logs.


15 months ago

This ticket was mentioned in Slack in #core-multisite by soean. View the logs.


15 months ago

#8 @Soean
15 months ago

I created a Pull request on GitHub

@realloc commented on PR #8915:


4 weeks ago
#9

@Soean, please update your PR since it has conflicts. Let's try to push the ticket forward afterwards.

@Soean commented on PR #8915:


4 weeks ago
#10

@lloc I updated the PR and added a @since comment.

Note: See TracTickets for help on using tickets.