WordPress.org

Make WordPress Core

Opened 9 years ago

Last modified 16 months ago

#15865 reopened enhancement

Make it easy to disable options / user settings

Reported by: westi Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Options, Meta APIs Keywords: needs-refresh needs-testing
Focuses: administration Cc:

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 (5)

removal_functions.diff (3.2 KB) - added by ctsttom 8 years ago.
Addition of two new functions and a spelling error in a comment
removal_functions_2.diff (3.2 KB) - added by ctsttom 8 years ago.
Corrections to previous patch
dummy.php (3.4 KB) - added by ctsttom 8 years ago.
Aforementioned dummy plugin to test with
removal_functions_3.diff (3.3 KB) - added by unknowndomain 7 years ago.
example_settings.diff (21.7 KB) - added by unknowndomain 6 years ago.
Example of how the Settings API might be implemented.

Download all attachments as: .zip

Change History (44)

#1 @scribu
9 years ago

  • Cc scribu added

#2 @scribu
9 years ago

  • Type changed from defect (bug) to enhancement

#3 @kpdesign
9 years ago

  • Cc kparsell-wp@… added

#4 @ptahdunbar
8 years ago

  • Cc trac@… added

#5 @westi
8 years ago

  • Keywords westi-likes added; 3.2-early removed

#6 @danielbachhuber
8 years ago

  • Cc d@… added

#7 @scribu
8 years ago

Tempted to close this as duplicate of #16413

#8 @scribu
8 years ago

Related: #18251

#9 @scribu
8 years ago

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

remove_settings_field() remove_settings_section() remove_settings_error()

#10 @ctsttom
8 years ago

  • 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.

#12 @ctsttom
8 years ago

  • 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...

@ctsttom
8 years ago

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

#13 @scribu
8 years ago

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) {

@ctsttom
8 years ago

Corrections to previous patch

@ctsttom
8 years ago

Aforementioned dummy plugin to test with

#14 @ctsttom
8 years ago

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.

#15 @ctsttom
8 years ago

Would someone review this for inclusion?

#16 @scribu
8 years ago

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

#17 @ctsttom
8 years ago

@scribu Thanks, I will hold off then.

#18 @ctsttom
8 years ago

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

#19 @scribu
7 years ago

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

#20 @eddiemoya
7 years ago

  • Cc eddie.moya+wptrac@… added

#21 @unknowndomain
7 years ago

  • 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

#22 @knutsp
7 years ago

  • Cc knut@… added

#23 @unknowndomain
7 years ago

  • Keywords settings-3.6 added; has-patch needs-testing removed

#24 @SergeyBiryukov
7 years ago

  • Keywords has-patch added

#25 @mordauk
7 years ago

  • Cc pippin@… added

#26 @ctsttom
7 years ago

  • Keywords needs-refresh 3.6 added; has-patch removed

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

#27 @SergeyBiryukov
7 years ago

  • Keywords 3.6 removed

#28 @SergeyBiryukov
7 years ago

  • Keywords 3.6-early added

#29 @SergeyBiryukov
7 years ago

  • Keywords settings-api added; settings-3.6 removed

#30 @unknowndomain
7 years ago

  • 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!

#31 @unknowndomain
6 years ago

  • Keywords 3.6-early removed

I am looking at this again, just wondering if people think it would be best to just wrap the existing code in settings api stuff for now, and @helen is going to be looking at #16413 in 3.8 anyways.

@unknowndomain
6 years ago

Example of how the Settings API might be implemented.

#32 @unknowndomain
6 years ago

I have been playing about and you can see this might be one way of implementing the settings api to these files, I haven't done even one whole file as it is time consuming, but perhaps people could provide feedback on my patch and how it might work?

#33 @chriscct7
4 years ago

  • Keywords needs-refresh needs-testing added; westi-likes settings-api removed
  • Milestone changed from Future Release to 4.4
  • Owner changed from westi to chriscct7
  • Status changed from new to assigned

I'm going to take a look at this as part of #32396

#34 @chriscct7
4 years ago

  • Keywords has-patch removed
  • Milestone 4.4 deleted
  • Resolution set to duplicate
  • Status changed from assigned to closed

Duplicate of #28754.

#35 @chriscct7
4 years ago

  • Resolution duplicate deleted
  • Status changed from closed to reopened

#36 @chriscct7
4 years ago

  • Owner chriscct7 deleted
  • Status changed from reopened to assigned

#37 @chriscct7
4 years ago

  • Resolution set to duplicate
  • Status changed from assigned to closed

Duplicate of #28754.

#38 @alpipego
17 months ago

  • Resolution duplicate deleted
  • Status changed from closed to reopened

I can't see how this is a dupe.

#39 @SergeyBiryukov
16 months ago

  • Component changed from Administration to Options, Meta APIs
  • Focuses administration added
  • Milestone set to Awaiting Review
Note: See TracTickets for help on using tickets.