Opened 2 years ago

Last modified 4 months ago

#15865 new enhancement

Make it easy to disable options / user settings

Reported by: westi Owned by: westi
Priority: normal Milestone: Future Release
Component: Administration Version:
Severity: normal Keywords: westi-likes settings-api 3.6-early has-patch
Cc: scribu, kparsell-wp@…, trac@…, d@…, me@…, eddie.moya+wptrac@…, unknowndomain, knut@…, pippin@…

Description

We have a wonderful option white listing system.

The one thing it doesn't support is hiding the ui of core options if you don't want them changed.

We should have a generic way of doing this.

Attachments (4)

removal_functions.diff (3.2 KB) - added by ctsttom 22 months ago.
Addition of two new functions and a spelling error in a comment
removal_functions_2.diff (3.2 KB) - added by ctsttom 22 months ago.
Corrections to previous patch
dummy.php (3.4 KB) - added by ctsttom 22 months ago.
Aforementioned dummy plugin to test with
removal_functions_3.diff (3.3 KB) - added by unknowndomain 4 months ago.

Download all attachments as: .zip

Change History (34)

  • Cc scribu added
  • Type changed from defect (bug) to enhancement
  • Cc kparsell-wp@… added
  • Cc trac@… added
  • Keywords westi-likes added; 3.2-early removed
  • Cc d@… added

Tempted to close this as duplicate of #16413

Related: #18251

The first thing we need, as mentioned in #18251, is the missing functions:

remove_settings_field() remove_settings_section() remove_settings_error()

  • Cc me@… added

If someone would mentor me a little on this I will try and do it and submit the patch, would love to get into core dev work but just a little confused as to where to start... I know kung-fu (PHP) and I have a couple of plugins but the leap seems a little uncomfortable to pitch my fork in.

  • Keywords has-patch needs-testing added

Okay so here is my first attempt to add the two functions I suggested, I didn't add remove_settings_error() because I don't really know why you'd want that / I don't under stand that part yet...

I also wrote a dummy plugin to test the code out with (there is a function within it called test_removal() which you can uncomment to test, and var_dump the globals $wp_settings_sections and $wp_settings_fields from /wp-admin/includes/template.php

Files attached...

Addition of two new functions and a spelling error in a comment

Instead of if ( count( $wp_settings_fields[$page] ) == 0 ), you should use empty(), which is faster.

Also, spaces are needed before and after the parameter list:

function remove_settings_section($id, $page) {

Corrections to previous patch

Aforementioned dummy plugin to test with

I have fixed those two points, funnily enough I was going to put spaces around the parameter list but every other function in that file was missing those so I thought I shouldn't do it.

Would someone review this for inclusion?

We need to figure out what we're going to do in #18285 first.

@scribu Thanks, I will hold off then.

Where are we at with this, and the Settings API stuff?

We are nowhere. A winning approach has not been found yet.

  • Cc eddie.moya+wptrac@… added
  • Cc unknowndomain added

Hey folks,

Wanted to notify you of a call to action on this tickets blocking ticket:
http://core.trac.wordpress.org/ticket/18285#comment:76

Thanks

Tom

  • Cc knut@… added
  • Keywords settings-3.6 added; has-patch needs-testing removed
  • Keywords has-patch added
  • Cc pippin@… added
  • Keywords needs-refresh 3.6 added; has-patch removed

Once 3.5.1 is out of the way I am going to referesh this.

  • Keywords 3.6 removed
  • Keywords 3.6-early added
  • Keywords settings-api added; settings-3.6 removed
  • Keywords has-patch added; needs-refresh removed

I have updated my patch for 3.6 and added remove_settings_error, and some minor changes to my documentation.

Would love a review on this!

Note: See TracTickets for help on using tickets.