WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#39200 closed enhancement (fixed)

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

Reported by: sathyapulse Owned by: flixos90
Milestone: 4.8 Priority: normal
Severity: normal Version:
Component: Role/Capability Keywords: has-patch
Focuses: multisite Cc:
PR Number:

Description

This is part of the #37616 task. There are 2 is_super_admin() checks in wp-includes/option.php that should be replaced with current_user_can( 'manage_network' ).

See: https://core.trac.wordpress.org/ticket/37616#comment:26

Attachments (3)

39200.patch (954 bytes) - added by sathyapulse 3 years ago.
39200.1.patch (4.1 KB) - added by sathyapulse 3 years ago.
39200.2.patch (1011 bytes) - added by sathyapulse 3 years ago.

Download all attachments as: .zip

Change History (9)

@sathyapulse
3 years ago

#1 @flixos90
3 years ago

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

Hi @sathyapulse, and thanks for the patch! It looks good so far. One minor thing we could adjust is to add curly braces around the clause in line 163: Since we are changing the line anyway, it's a good habit to adjust this clause to follow the proper coding standards.

Feel free to update your patch accordingly, that would be great! :)

@sathyapulse
3 years ago

#2 @sathyapulse
3 years ago

Hi @flixos90,

Thank you for the suggestion. I should have noticed that earlier. I have attached the new patch file which includes the missing curly braces throughout the file. Please let me know if any other changes need to be done in the file. I am happy to do it.

#3 @flixos90
3 years ago

  • Keywords needs-refresh added
  • Status changed from assigned to reviewing

Thanks for the update @sathyapulse.

I think we had a small misunderstanding here, the code format should only be adjusted in lines (or their direct environment) which are changed anyway. In 39200.1.patch you added curly braces throughout the entire file, but this makes the diff unreadable since it's unclear what the actual functional code change was.
Only the one clause that you changed in 39200.patch line 163 should get curly braces, please ignore the other ones. Could you please update the patch? It's probably easiest if you do it based on your initial patch.

@sathyapulse
3 years ago

#4 @sathyapulse
3 years ago

@flixos90 Sorry, the patch is updated as per your request.

Last edited 3 years ago by sathyapulse (previous) (diff)

#5 @flixos90
3 years ago

  • Keywords needs-refresh removed

Perfect, thanks a lot @sathyapulse!

#6 @flixos90
3 years ago

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

In 39933:

Multisite: Replace is_super_admin() with manage_network_options in wp-admin/options.php.

Props sathyapulse.
Fixes #39200. See #37616.

Note: See TracTickets for help on using tickets.