Make WordPress Core

Opened 12 years ago

Closed 8 years ago

#21788 closed enhancement (fixed)

Relocate revoke_super_admin() and grant_super_admin() to capabilities.php

Reported by: johnjamesjacoby's profile johnjamesjacoby Owned by: jeremyfelt's profile jeremyfelt
Milestone: 4.6 Priority: normal
Severity: normal Version:
Component: Role/Capability Keywords: has-patch
Focuses: multisite Cc:

Description

Would be nice to move revoke_super_admin() and grant_super_admin() out of /wp-admin/includes/ms.php and into to /wp-includes/capabilities.php, where the rest of the _super_admin() functions are.

This allows theme-side user profile plugins (see: the bb's) to use these functions without needing to pull in a wp-admin file directly.

Attachments (2)

21788.patch (3.7 KB) - added by johnjamesjacoby 12 years ago.
21788.diff (6.4 KB) - added by jeremyfelt 8 years ago.

Download all attachments as: .zip

Change History (17)

#1 @nacin
12 years ago

Should probably be moved to ms-functions.php, or be made non-multisite aware (in which case they wouldn't do anything). I'm okay with this but it was nice to have these in the admin only, I guess to avoid people shooting themselves in the foot. wp_delete_user() and wpmu_delete_user() are similarly in the admin.

#2 @johnjamesjacoby
12 years ago

Same with:

  • update_user_status()
  • refresh_user_details() (not used anywhere in core.)
  • upload_is_user_over_quota() (Would prevent function exists check in class-wp-importer.php.)

#3 @johnjamesjacoby
9 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 4.1

Bumping to 4.1 to be reconsidered in conjunction with other multisite code changes.

#4 follow-up: @ocean90
9 years ago

  • Milestone changed from 4.1 to Future Release

It's a bit late to move some code around, should be done early in a cycle.

#5 in reply to: ↑ 4 ; follow-up: @johnjamesjacoby
9 years ago

Replying to ocean90:

It's a bit late to move some code around, should be done early in a cycle.

This was opened 6 releases ago, and moved 4 weeks ago (2 weeks before beta.)

What's the sweet spot to get this done without being noisy about it?

#6 @chriscct7
8 years ago

  • Keywords early added

#7 in reply to: ↑ 5 ; follow-up: @jeremyfelt
8 years ago

  • Milestone changed from Future Release to 4.5

We can get this one in early. :)

#8 @jeremyfelt
8 years ago

  • Owner set to jeremyfelt
  • Status changed from new to accepted

#9 in reply to: ↑ 7 @jeremyfelt
8 years ago

  • Focuses multisite added
  • Keywords 4.6-early added; early removed
  • Milestone changed from 4.5 to Future Release

Replying to jeremyfelt:

We can get this one in early. :)

My bad. :(

4.6 it is and I'm adding early to it / writing it on my board. :)

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


8 years ago

@jeremyfelt
8 years ago

#11 @jeremyfelt
8 years ago

  • Keywords has-patch added; needs-patch removed
  • Type changed from defect (bug) to enhancement

21788.diff is a refresh against current trunk. It also adds an is_multisite() check to immediately bail if used for single site.

#12 follow-up: @johnjamesjacoby
8 years ago

Nice! Interesting catch with the is_multisite() additions.

These functions conveniently use the _site_option() functions, which technically do work on single-site, so I don't know that adding is_multisite() is necessary necessary, but I suppose probably wise.

Patch applies cleanly.

#13 in reply to: ↑ 12 @jeremyfelt
8 years ago

Replying to johnjamesjacoby:

These functions conveniently use the _site_option() functions, which technically do work on single-site, so I don't know that adding is_multisite() is necessary necessary, but I suppose probably wise.

Yeah, it seems like a good idea to move the functions first before thinking about whether support for grant/revoke should be added to single site.

#14 @jeremyfelt
8 years ago

  • Keywords 4.6-early removed
  • Milestone changed from Future Release to 4.6

#15 @jeremyfelt
8 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 37200:

Multisite: Relocate revoke_super_admin() and grant_super_admin()

Moving these functions to wp-includes/capabilities.php allows plugins to access more than just is_super_admin() and get_super_admin() from the front end without including a file via wp-admin/. Add an is_multisite() check to prevent use of these on single site environments now that they have left ms.php..

Props johnjamesjacoby.
Fixes #21788.

Note: See TracTickets for help on using tickets.