#16358 closed defect (bug) (fixed)
Menu items get deleted with the user who created them
Reported by: | nacin | Owned by: | ryan |
---|---|---|---|
Milestone: | 3.4 | Priority: | high |
Severity: | major | Version: | 3.0 |
Component: | Menus | Keywords: | has-patch commit needs-codex |
Focuses: | Cc: |
Description
Say a user edits a nav menu or two, adding some menu items. Then, said user gets deleted. Rut roh:
SELECT ID FROM $wpdb->posts WHERE post_author = %d
The menu items were tied to them, therefore they are deleted.
We need to ensure that wp_delete_user() doesn't touch nav menu items.
This has repercussions for any post type that doesn't care about authors. Tempted to actually check, post_type_supports(), which is typically reserved for UI-level actions. Otherwise, post_author always gets stored, and that seems to be just a bit of a problem. (It could be argued this is a UI-level check, in terms of confirming things to delete.)
Unsure how this didn't come up previously. Reported by flashingcursor over Twitter.
Attachments (8)
Change History (28)
#2
@
14 years ago
In patch 1, I forgot revision. You get the idea.
Second patch leverages post_type_supports.
#3
@
14 years ago
Option 3 is to avoid deleting nav menu items only, and leave CPT handling to a filter, with the default of delete. (Default of not delete would be option 1.)
#4
@
14 years ago
Patch might overlap with #16359.
Note, probably goes without saying, but none of these were actually tested. We need a plan of action on which to choose, more importantly.
#6
@
14 years ago
- Keywords 3.2-early added; dev-feedback removed
- Milestone changed from 3.1 to Future Release
- Severity changed from critical to major
This is not a regression in 3.1 so can wait till 3.2 to be fixed.
#7
@
14 years ago
Would not mind a `AND post_type <> 'nav_menu_item' in 3.1. This is a nasty dumb bug.
#8
@
14 years ago
I like the idea of doing this based on whether the post type supports authors, as that generalizes well.
Is there any reason the core post type definitions don't declare author support for revisions and attachments?
#13
@
13 years ago
- Keywords 3.3-early removed
- Milestone changed from Future Release to 3.4
Bummed this keeps getting punted. I think it definitely falls into 'making your site look the way you want it to look' plan, for 3.4, so let's see if someone can work on this for 3.4 early.
To be honest, it says 'posts and links'. We do fire an action there that custom post types could use.
Tempted to hard restrict it to posts, pages, and attachments.
Moving to 3.1. This one seems bad.