Opened 15 years ago
Last modified 6 years ago
#13473 reopened defect (bug)
comment_status should be set to default_comment_status when commentstatusdiv is removed
Reported by: | jimmcq | Owned by: | westi |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Comments | Keywords: | needs-patch |
Focuses: | administration | Cc: |
Description
When the Comment Status box is removed from the Add/Edit Post screens, posts should be created with the comment_status set to the value of the default_comment_status option.
I had hidden the Comment Status box via:
remove_meta_box('commentstatusdiv','post','normal');
and made sure that default_comment_status was set to open:
update_option('default_comment_status', 'open');
After adding a new post it displayed "Comments Off" when I was assuming that it should have honored the value of default_comment_status.
Attachments (2)
Change History (21)
#2
@
15 years ago
In a multi-site setup, I was trying to simplify the dashboard by removing some extra metaboxes. It just seemed logical to me that the default_comment_status would be honored even that metabox wasn't shown.
I was hoping that removing the box would mean that comments would be on for every post, and that the users wouldn't be able to turn them off. Is there another way to easily accomplish this?
(Yeah, I know I could probably catch a hook when the post is published as modify the comment_status then, but it just seems like extra unnecessary hoops to jump through)
#3
@
15 years ago
I've tried the same thing before. I'd tend to agree that removing the meta box should keep the defaults, not set them all to false.
#4
@
14 years ago
- Keywords needs-patch added; comments removed
- Milestone changed from Awaiting Review to Future Release
#5
@
13 years ago
- Cc chuck@… added
Have same issue... bug... noticed while back but figured it was something else, but now it's really annoying due to a plugin I made removing commentstatusdiv. needs-patch.
#6
@
13 years ago
- Keywords has-patch added; needs-patch removed
- Milestone changed from Future Release to 3.3
#8
@
13 years ago
I think we should be checking whether the post type supports comments before setting the comment status to default_comment_status
, and if it doesn't, set it to closed.
I'm thinking in particular of older themes which don't use post_type_supports()
in their comment handling code. They could get confused if comments are open on a post type that doesn't support comments.
#9
@
13 years ago
- Milestone changed from 3.3 to Future Release
This doesn't get much attention. We should review it again in 3.4 and check also the other metaboxes like ryan mentioned.
#10
@
13 years ago
- Keywords commit added
- Milestone changed from Future Release to 3.3
I thought I would prefer 13473.patch over 13473.diff, but the latter is more flexible. And it makes sense: If there should be a UI but it is removed, assume the default; otherwise, assume the existing. Suggesting commit.
#11
@
13 years ago
- Owner set to westi
- Resolution set to fixed
- Status changed from new to closed
In [19372]:
#13
@
13 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
Okay, so, the trick here would be to include a hidden input that is always sent from the Discussion box. If it is set, then the box is there and things are unchecked. If it is not set, then the meta box is not there, and we can assume that we need to use the default.
However, if someone unregisters the discussion meta box to register their own with these two checkboxes (piggybacking on what WordPress saves by default is not unheard of for other meta boxes), this will fail to work.
As this is not a regression and is only obtainable by unregistering the meta box in code, I'm going to revert.
I'm sure there are similar issues with other meta boxes too. Removing the boxes is not well defined. It can be argued that if the box is removed entirely the status should be off.