WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#18082 closed enhancement (wontfix)

Reset screen options button

Reported by: danielbachhuber Owned by: danielbachhuber
Milestone: Priority: normal
Severity: minor Version:
Component: Administration Keywords:
Focuses: Cc:

Description

It would be nice to have a "Reset" button in screen options to restore any given admin view back to the factory defaults.

Attachments (2)

resetscreen.18082.1.patch (5.6 KB) - added by danielbachhuber 3 years ago.
Functional first pass at adding a reset button for screen options
resetscreen.18082.2.patch (5.7 KB) - added by danielbachhuber 3 years ago.
Improvements per Nacin's recommendations

Download all attachments as: .zip

Change History (9)

comment:1 chacha1023 years ago

  • Cc chacha102 added

comment:2 danielbachhuber3 years ago

  • Keywords ux-feedback added
  • Owner set to danielbachhuber
  • Status changed from new to accepted

danielbachhuber3 years ago

Functional first pass at adding a reset button for screen options

comment:3 danielbachhuber3 years ago

  • Keywords has-patch 2nd-opinion added

resetscreen.18082.1.patch adds a "Reset to defaults" button for all screen options. When the user clicks on the reset button, all of their personal screen options for the current screen are reset to factory defaults.

The patch works fine, I think the code is satisfactory, but I'd love feedback on the approach. Ideally, we'd just write an actual class and API for manipulating screen options. This could work fine in the interim though.

comment:4 nacin3 years ago

I would keep the if() logic in set_screen_options() and reset_screen_options(), and consider combining your reset_screen_options() with set_screen_options() -- it's nice and easy to have a single POST handler here.

Patch looks alright at a glance, but there's a lot moving around, so we'd have to look closer.

There should also be a hook so a plugin can reset theirs too.

danielbachhuber3 years ago

Improvements per Nacin's recommendations

comment:5 danielbachhuber3 years ago

@nacin Added another patch per your recommendations. Specifically, I moved the $_POST checks to the methods (although I'd prefer to keep the set_ and reset_ methods separate because they do different things). Also, I added an action called 'reset_screen_options'.

comment:6 danielbachhuber3 years ago

  • Keywords ux-feedback has-patch 2nd-opinion removed
  • Resolution set to wontfix
  • Status changed from accepted to closed

Closing this as "wontfix" because both bugs (#18198, #16955) that having a "Reset" button provides a solution for are fixed as of WP 3.3

comment:7 SergeyBiryukov3 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.