WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#11184 closed defect (bug) (fixed)

Bulk actions executed on empty list causes errors

Reported by: sirzooro Owned by: westi
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.9
Component: Warnings/Notices Keywords:
Focuses: Cc:

Description

When you try to execute bulk actions but do not select at least item first, WP displays errors:

  • attempt to buld edit posts - PHP notice:

Notice: Undefined variable: authors_dropdown in C:\wordpress29.local\wp-admin\includes\template.php on line 1118

  • attempt to delete tags or custom taxonomies - WP Failure Notice screen:

Notice: Undefined index: tag_ID in C:\wordpress29.local\wp-admin\edit-tags.php on line 47
Are you sure you want to do this?
Please try again.

  • attempt to delete categories - WP Failure Notice screen:

Notice: Undefined index: cat_ID in C:\wordpress29.local\wp-admin\categories.php on line 37
Notice: Undefined property: WP_Error::$name in C:\wordpress29.local\wp-includes\category.php on line 186
Your attempt to delete this category: “” has failed.
Please try again.

Attachments (7)

11184.diff (1.1 KB) - added by dd32 4 years ago.
Initialize and indent
11184-cats-tags.patch (783 bytes) - added by nacin 4 years ago.
11184-cats-tags-2.patch (2.2 KB) - added by nacin 4 years ago.
New messages for cat/tag/tax bulk editing
11184-cats-tags-links-3.2.patch (4.4 KB) - added by nacin 4 years ago.
New patch for bulk action feedback: cats, tags/tax, links & link cats
11184-4-bulkedit.patch (986 bytes) - added by nacin 4 years ago.
Edit posts/pages - don't show bulk edit if nothing is selected
11184-5-plugins.patch (1.7 KB) - added by nacin 4 years ago.
Removes E_NOTICE from plugins bulk action
11184-merged-for-2.9.patch (7.2 KB) - added by nacin 4 years ago.
Bulk action 2.9 fixes

Download all attachments as: .zip

Change History (24)

comment:1 follow-up: sirzooro4 years ago

One more thing: when you try to delete permanently posts in trash in bulk, WP displays displays all posts instead of trashed ones only.

comment:2 in reply to: ↑ 1 scribu4 years ago

  • Component changed from General to Warnings/Notices
  • Owner set to westi

Replying to sirzooro:

One more thing: when you try to delete permanently posts in trash in bulk, WP displays displays all posts instead of trashed ones only.

You should open a separate ticket for that.

comment:3 sirzooro4 years ago

This ticket is not only for PHP notices - they should be of course fixed. My main intention is to stop calling wp_die() when no items are selected for bulk action - WP should either do nothing (maybe just reload page), or display some warning like "no items selected".

dd324 years ago

Initialize and indent

comment:4 dd324 years ago

  • Keywords has-patch added; needs-patch removed

attachment 11184.diff added

  • bulk edit posts
    • Initialize variable to prevent unset warnings
    • indent code to show the if branch better.

Other issues not touched.

comment:5 azaozz4 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [12285]) Fix notice in bulk edit posts, props dd32, fixes #11184

comment:6 dd324 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

My patch did no fix the other mentioned warnings in this ticket.

nacin4 years ago

comment:7 nacin4 years ago

Patch attached to fix remaining warnings for edit-tags.php and categories.php.

comment:8 sirzooro4 years ago

These patches do not fix the main reason why I logged this ticket - WP calls wp_die() when you do not select any tag/taxonomy/category for bulk delete. I think WP should show fading warning in such cases.

The same is for bulk post remove - see my 1st reply.

comment:9 nacin4 years ago

New patch.

  • If no tags or categories selected on a bulk delete, flash "No (tags|categories) selected."
  • If categories are bulk-deleted, there was previously no flash. Patch adds them. Patch also checks how many tags/cats are deleted to serve the appropriate message.

I'm thinking this can make it into 2.9. The post edit.php issues are trivial -- while there isn't any feedback, but it also doesn't wp_die(). Let's do that in a new ticket, and prevent bulk edit from opening if no posts are selected.

FWIW, re:

One more thing: when you try to delete permanently posts in trash in bulk, WP displays displays all posts instead of trashed ones only.

I don't recall another ticket to fix this, in which case I can't reproduce in r12314.

nacin4 years ago

New messages for cat/tag/tax bulk editing

comment:10 nacin4 years ago

Latest also includes link-manager.php

Still todo but lower priority: posts, pages. Also: media, comments.

comment:11 nacin4 years ago

This quick patch won't allow bulk edit to appear if nothing is selected. No feedback is better than a box that opens that can't be used.

Just found another E_NOTICE issue for plugins bulk actions. I suppose I should roll all of these patches into one? Current ones are 11184-cats-tags-links-3.2, 4-bulkedit and 5-plugins.

For 3.0: Add feedback to posts, pages, media, comments, plugins screens. (Or, remove "No (tax) selected" feedback from tags/tax, cats, link-cats, for consistency.)

nacin4 years ago

New patch for bulk action feedback: cats, tags/tax, links & link cats

nacin4 years ago

Edit posts/pages - don't show bulk edit if nothing is selected

nacin4 years ago

Removes E_NOTICE from plugins bulk action

comment:12 azaozz4 years ago

Yeah, it probably would have been better if all patches were in one diff, perhaps for the next ticket.

comment:13 nacin4 years ago

Latest patch (11184-merged-for-2.9.patch) contains all fixes mentioned here, aside from the ones we can leave for 3.0.

nacin4 years ago

Bulk action 2.9 fixes

comment:14 azaozz4 years ago

It seems there are some other problems at these places, like the action for single delete (when no JS) is the same as the action for bulk delete, etc. Perhaps better to rename all bulk actions to something like "bulk-delete".

Don't think we can get this in 2.9 as there may be plugin compatibility issues. Will apply the part of the patch that clears the PHP notices but will leave the rest for 3.0 as it's better to fix all these properly and add "Nothing selected" messages, etc.

comment:15 azaozz4 years ago

(In [12317]) Fix errors when bulk actions executed on empty list, props nacin, see #11184

comment:16 azaozz4 years ago

  • Keywords has-patch removed
  • Milestone changed from 2.9 to 3.0

comment:17 nacin4 years ago

  • Milestone changed from 3.0 to 2.9
  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.