Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#39207 closed enhancement (fixed)

Replace is_super_admin() check with current_user_can( 'manage_options' ) in wp-admin/options-general.php

Reported by: dhaval-parekh's profile Dhaval Parekh Owned by: flixos90's profile flixos90
Milestone: 4.8 Priority: normal
Severity: normal Version:
Component: Options, Meta APIs Keywords: has-patch commit
Focuses: multisite Cc:


This is part of the task. There is 1 is_super_admin() checks in wp-admin/options-general.php that should be replaced with current_user_can( 'manage_options' ).

Attachments (2)

ticket-39207.patch (665 bytes) - added by Dhaval Parekh 8 years ago.
Replaced is_super_admin() check with current_user_can( 'manage_options' )
39207.diff (757 bytes) - added by flixos90 8 years ago.

Download all attachments as: .zip

Change History (8)

@Dhaval Parekh
8 years ago

Replaced is_super_admin() check with current_user_can( 'manage_options' )

#1 @flixos90
8 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 4.8
  • Owner set to flixos90
  • Status changed from new to reviewing
  • Type changed from defect (bug) to enhancement

Hi @Dhaval Parekh, and thanks for the patch - looks good!

#2 @johnbillion
8 years ago

  • Component changed from Role/Capability to Options, Meta APIs
  • Keywords needs-patch added; has-patch removed

The intention of this line of code is to only show the WPLANG warning to super admins on a multisite installation. A regular administrator on multisite should not see this message, but an administrator on a single site installation should.

I'm not sure which cap would be more appropriate to check for here. Maybe:

if ( ! is_multisite() || current_user_can( 'manage_network_options )`

#3 @ocean90
8 years ago

I wouldn't mind if we just remove this warning. It was introduced 2 years ago in [29630].

#4 @flixos90
8 years ago

+1 on removing the warning. I think the regular _deprecated_argument() call can remain, it should really be sufficient as a warning for a developer.

Let's open a new ticket if we agree on this - this here would then become invalid. :)

8 years ago

#5 @flixos90
8 years ago

  • Keywords has-patch commit added; needs-patch removed

39207.diff makes the check available to network administrators on multisite and regular administrators on non-multisite.

Generally using a new meta capability would be more elegant, but since it is only about a simple notice that might possibly removed soon, let's use the check from the new patch.

#6 @flixos90
8 years ago

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

In 39947:

Multisite: Replace is_super_admin() with a proper capability check when showing a notice about WPLANG.

In multisite, the notice is displayed to users that have the manage_network_options capability. In non-multisite, the notice is displayed to users with the manage_options capability.

Props Dhaval Parekh.
Fixes #39207. See #37616.

Note: See TracTickets for help on using tickets.