Make WordPress Core

Opened 4 years ago

Last modified 12 days ago

#19159 accepted enhancement

When Inactive Widgets list gets long it is hard to clear

Reported by: westi Owned by: cdog
Milestone: 4.4 Priority: normal
Severity: normal Version: 3.3
Component: Widgets Keywords: ux-feedback dev-feedback has-patch
Focuses: ui Cc:


If you have a lot of inactive widgets it can be really hard manual labour to remove them all.

It would be much nicer if there was a delete all button like this plugin adds http://wordpress.org/extend/plugins/remove-inactive-widgets/

Attachments (6)

19159.diff (4.5 KB) - added by cdog 3 years ago.
19159.jpg (19.9 KB) - added by cdog 3 years ago.
19159.2.diff (4.8 KB) - added by cdog 3 years ago.
19159.3.diff (4.9 KB) - added by cdog 3 years ago.
19159.4.diff (4.9 KB) - added by cdog 5 weeks ago.
19159.5.diff (5.6 KB) - added by cdog 13 days ago.

Download all attachments as: .zip

Change History (25)

comment:1 @cdog3 years ago

  • Cc catalin.dogaru@… added

comment:2 @cdog3 years ago

  • Keywords has-patch added; needs-patch removed

attachment:19159.diff adds support to clear asynchronously the Inactive Widgets list. It works properly with JavaScript disabled too. The output can be previewed here: attachment:19159.jpg.

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

@cdog3 years ago

@cdog3 years ago

comment:3 @cdog3 years ago

  • Owner set to cdog
  • Status changed from new to accepted

comment:4 @cdog3 years ago

  • Keywords ux-feedback added

@cdog3 years ago

comment:5 @cdog3 years ago

  • Keywords needs-testing added

attachment:19159.2.diff updates my previous submission so the patch can be tested against the latest revision (23132).

While updating I've noticed a bug with the spinner which I reported here: ticket:22839.

Version 0, edited 3 years ago by cdog (next)

@cdog3 years ago

comment:6 @cdog3 years ago

attachment:19159.3.diff uses .css() to set the display property to inline-block instead of .show() to avoid ticket:22839.

comment:7 @nacin3 years ago

  • Cc lessbloat added

Adding lessbloat as CC for a potential user test.

comment:8 @ocean903 years ago

#23080 was marked as a duplicate.

comment:9 @chriscct75 weeks ago

  • Focuses ui added
  • Keywords dev-feedback added; westi-likes 3.4-early removed
  • Severity changed from minor to normal

comment:10 @DrewAPicture5 weeks ago

  • Keywords needs-refresh added; needs-testing removed

Patch needs a refresh.

@cdog5 weeks ago

comment:11 @cdog5 weeks ago

Here it is, attachment:19159.4.diff applies against the current revision. Going to document the code. Let me know if there's anything more to update like texts or ui elements.

Last edited 5 weeks ago by cdog (previous) (diff)

comment:12 @slackbot5 weeks ago

This ticket was mentioned in Slack in #core by cdog. View the logs.

comment:13 @SergeyBiryukov5 weeks ago

  • Keywords needs-refresh removed
  • Milestone changed from Future Release to 4.4

comment:14 follow-up: @alexvorn22 weeks ago

  • Keywords needs-patch added; has-patch removed

Note: Making the inactive sidebar array empty is not enough! We need also to clear the widget settings from the database of each widget ID from Inactive Widgets Sidebar.

The new patch should check every widget id from it's own database value and remove itself from the table.

@cdog13 days ago

comment:15 in reply to: ↑ 14 @cdog13 days ago

  • Keywords has-patch added; needs-patch removed

alexvorn2 thanks, that was missing from the patch. Anyone wanting/able to review the patch? I'm also interested if there's any other way to remove a widget by its ID without parsing it.

comment:16 follow-up: @chriscct713 days ago

Couple things so far.

Any thing that uses $_POST should be isset checked, so for example before

unset( $_POST['removeinactivewidgets'], $_POST['action'] );

the POST value should be checked to ensure it exists

Also because this is a new patch, it should follow the current WP code guidelines, so

 if ( ! current_user_can( 'edit_theme_options' ) ) 
 	wp_die( -1 );

should be

 if ( ! current_user_can( 'edit_theme_options' ) ) { 
 	wp_die( -1 );

comment:17 in reply to: ↑ 16 @cdog13 days ago

chriscct7 got it. Let's see if there's anything more that needs to be updated and I'm going to apply these changes.

comment:18 follow-up: @alexvorn212 days ago

you should prevent clicking multiple times/spamming the "remove inactive widgets" button.

comment:19 in reply to: ↑ 18 @cdog12 days ago

alexvorn2 when should the button be disabled? While processing the request, when the list is empty, or both?

Also regarding the UI and texts, is there anything that should be updated?

Last edited 12 days ago by cdog (previous) (diff)
Note: See TracTickets for help on using tickets.