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)
Change History (11)
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
This ticket was mentioned in PR #8915 on WordPress/wordpress-develop by @Soean.
15 months ago
#7
Trac ticket: https://core.trac.wordpress.org/ticket/43390
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Just realized that
grant_super_admin()andrevoke_super_admin()are also affected.Lines 820 and 867 in
wp-includes/capabilities.phpboth read:$super_admins = get_site_option( 'site_admins', array( 'admin' ) );