Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#11184 closed defect (bug) (fixed)

Bulk actions executed on empty list causes errors

Reported by: sirzooro's profile sirzooro Owned by: westi's profile 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 15 years ago.
Initialize and indent
11184-cats-tags.patch (783 bytes) - added by nacin 15 years ago.
11184-cats-tags-2.patch (2.2 KB) - added by nacin 15 years ago.
New messages for cat/tag/tax bulk editing
11184-cats-tags-links-3.2.patch (4.4 KB) - added by nacin 15 years ago.
New patch for bulk action feedback: cats, tags/tax, links & link cats
11184-4-bulkedit.patch (986 bytes) - added by nacin 15 years ago.
Edit posts/pages - don't show bulk edit if nothing is selected
11184-5-plugins.patch (1.7 KB) - added by nacin 15 years ago.
Removes E_NOTICE from plugins bulk action
11184-merged-for-2.9.patch (7.2 KB) - added by nacin 15 years ago.
Bulk action 2.9 fixes

Download all attachments as: .zip

Change History (24)

#1 follow-up: @sirzooro
15 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.

#2 in reply to: ↑ 1 @scribu
15 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.

#3 @sirzooro
15 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".

@dd32
15 years ago

Initialize and indent

#4 @dd32
15 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.

#5 @azaozz
15 years ago

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

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

#6 @dd32
15 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

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

#7 @nacin
15 years ago

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

#8 @sirzooro
15 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.

#9 @nacin
15 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.

@nacin
15 years ago

New messages for cat/tag/tax bulk editing

#10 @nacin
15 years ago

Latest also includes link-manager.php

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

#11 @nacin
15 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.)

@nacin
15 years ago

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

@nacin
15 years ago

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

@nacin
15 years ago

Removes E_NOTICE from plugins bulk action

#12 @azaozz
15 years ago

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

#13 @nacin
15 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.

@nacin
15 years ago

Bulk action 2.9 fixes

#14 @azaozz
15 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.

#15 @azaozz
15 years ago

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

#16 @azaozz
15 years ago

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

#17 @nacin
15 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.