Ticket #5316 (new enhancement)

Opened 10 months ago

Last modified 4 months ago

Extend options.php to allow deletion, Viewing of Serialized, And grouping options

Reported by: DD32 Assigned to: anonymous
Priority: normal Milestone: 2.9
Component: Administration Version: 2.6
Severity: normal Keywords: has-patch options dev-feedback
Cc:

Description

I floated this idea back in September on wp-hackers: http://comox.textdrive.com/pipermail/wp-hackers/2007-September/thread.html#14425 ([wp-hackers] adding delete/autoload to options.php)

Basically this patch allows options to be deleted from the options.php page(By checking its checkbox - a JS confirmation is done before form submitting to make sure the user intends to delete them), Viewing of Serialized data, And also groups the options by name.

Grouping is achieved by taking the first word in the term, Ie. "test" in "test_plugin_data", If there are more than 2 terms with such a groupname, then they're promoted into their own section, This makes it easier to mass-select a particular 'groups' options to delete.

An invert selection option is also available for each group, So if a user wants to delete all the RSS cache items, They can either select all the cache items to remove, or, Select the items they wish to keep(in the rss section) and click Invert.

I've attached a plugin which is identical to the patch for those not wanting to apply the patch.

The linked wp-hackers thread mentioned also having an option to set autoload, I have not yet done that (As it'll require modifying/creating other functions) yet, But would like to include it, Just not sure how in the UI it could be managed without looking too crowded.

Attachments

5316.diff (8.8 kB) - added by DD32 on 11/04/07 02:48:38.
patch against trunk options.php
extended-options.php (6.7 kB) - added by DD32 on 11/04/07 02:49:06.
Patch in Plugin form
5316.2.diff (10.1 kB) - added by DD32 on 05/17/08 05:01:29.
Rewrite from scratch
5316.3.diff (12.4 kB) - added by DD32 on 05/17/08 07:09:49.
Some styling changes, styles in wp-admin.css were also combined (Mutliple styles for different ID's with the same code)
5316.4.diff (14.2 kB) - added by DD32 on 05/17/08 10:01:42.
5316.5.diff (16.3 kB) - added by DD32 on 05/18/08 05:15:34.

Change History

11/04/07 02:48:38 changed by DD32

  • attachment 5316.diff added.

patch against trunk options.php

11/04/07 02:49:06 changed by DD32

  • attachment extended-options.php added.

Patch in Plugin form

11/04/07 02:49:49 changed by DD32

  • type changed from defect to enhancement.

11/15/07 21:53:29 changed by johnbillion

  • keywords changed from has-patch options to has-patch options dev-feedback.

I really, really like this. Very convenient to be able to delete options from here (handy for plugin testing etc) and the grouping by prefix is very sexy.

I can see no reason for this going into core, as because of the relative obscurity of this options page, it won't affect the majority of people who use WordPress, and I'm sure the people who do use this options page from time to time will be in favour of these nice changes.

As its main aim is plugin developers (correct me if I'm wrong), it could just as effectively remain as a plugin though, so I'll give it a +0.75 for core.

11/15/07 21:54:58 changed by johnbillion

Oh also, it would be ace to be able to edit the serialized data. Can't imagine that would be too easy to do though.

11/15/07 22:10:48 changed by DD32

Editing serialized data was suggested on wp-hackers, And i've got a idea in my mind for how to achieve that thanks to some suggestions. (Well, Editing at least for Serialised Arrays, Objects are a bit harder).

It could effectivly stay as a plugin, which is why i wrapped it up into a plugin for this ticket, Since the options page is rather obscure, it doesnt affect many users, But most of these are changes which are useful to most people who use the options page(for whatever reason), I know some people who have a couple of thousand options in their WP installs (from playing with plugins over the years) - To them, the ability to delete a group of options from a plugin they no longer use would be great.

Its that reason why i thought as a core feature, It doesnt affect many people, But the options page IS there, Why not allow more control over the options for people who do tinker with their WP installs? (Thats more than just Plugin Developers, Allthough Devs are the main target for these changes)

02/07/08 17:56:05 changed by ryan

  • milestone changed from 2.5 to 2.6.

05/17/08 05:01:03 changed by DD32

  • version changed from 2.5 to 2.6.

Been playing around again, And scraped some of the ideas of this ticket.

Last time around when playing with Jeditable i found it wasnt really suited to the job that well, Since most of the fields are editable, it makes sense that the user should see textboxes for editing, rather than having to click to edit.

I'm adding a patch in a moment that allows:

  • Filtering of the table to only show rows matching a certain phrase
  • Allows Deletion of options via checkbox
  • Allows multiple checkbox's to be selected via Shift+select from the admin-forms JS
  • Javascript degrades into normal page reloading.

Things to note:

  • The checkAll() and shift+select range javascripts from admin-forms were modified to only check checkbox's in visible rows
    • Shouldnt affect any other uses of the admin-forms JS as they're only dealing with visible table rows anyway.
  • Added UI Table Filter script from http://gregweber.info/projects/uitablefilter (Dual Licenced under MIT and GPL)
    • I found that the script filtering to an empty phrase could be slow, So i've added a branch in the custom code to use my own routine.
    • Only filters to a search when the phrase is > 2 char in JS mode
  • Inline Javascript from the options page could be moved to an external script
  • No viewing of Serialised data, Yet. Unsure of what to do in those cases as currently it may be too hard to allow editing of such data
    • Simple arrays shouldnt be too hard, But more complex objects and nested arrays can be difficult

05/17/08 05:01:29 changed by DD32

  • attachment 5316.2.diff added.

Rewrite from scratch

05/17/08 07:09:49 changed by DD32

  • attachment 5316.3.diff added.

Some styling changes, styles in wp-admin.css were also combined (Mutliple styles for different ID's with the same code)

05/17/08 07:11:50 changed by DD32

attachment 5316.3.diff added.

  • Did away with the form-table, and moved over to the widefat table, While the form-table is generally used on the other settings pages, On tabalised data, the widefat class generally looks better. (And supports a check column better without adding extra styling)
  • Streamlined some other code and aligned things better.

The Columns still need to be worked out a bit more, And maybe some button changes need to be made, Some feedback for those would be nice.

05/17/08 10:01:42 changed by DD32

  • attachment 5316.4.diff added.

05/18/08 05:15:34 changed by DD32

  • attachment 5316.5.diff added.

05/18/08 05:16:52 changed by DD32

attachment 5316.5.diff added.

  • Adds Viewing of Serialised arrays
    • Doesnt allow viewing of Objects as generally they're cache files and rather large.
    • Doesnt support editing arrays.
  • degrades gracefully
  • All previous uses of options.php remain valid and require no changes