Make WordPress Core

Opened 14 years ago

Last modified 5 years ago

#13473 reopened defect (bug)

comment_status should be set to default_comment_status when commentstatusdiv is removed

Reported by: jimmcq's profile jimmcq Owned by: westi's profile westi
Milestone: Priority: normal
Severity: normal Version:
Component: Comments Keywords: needs-patch
Focuses: administration Cc:


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:

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)

13473.patch (771 bytes) - added by SergeyBiryukov 13 years ago.
13473.diff (921 bytes) - added by solarissmoke 13 years ago.
Check whether post type supports comments/pings before setting it to default

Download all attachments as: .zip

Change History (21)

#1 @ryan
14 years ago

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.

#2 @jimmcq
14 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 @nacin
14 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 @nacin
14 years ago

  • Keywords needs-patch added; comments removed
  • Milestone changed from Awaiting Review to Future Release

#5 @ryno267
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 @SergeyBiryukov
13 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from Future Release to 3.3

#7 @solarissmoke
13 years ago

  • Cc solaris.smoke@… added

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

13 years ago

Check whether post type supports comments/pings before setting it to default

#9 @ocean90
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 @nacin
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 @westi
13 years ago

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

In [19372]:

Respect the default comment/ping status for new posts even when someone has hidden the meta box which lets you alter them on a per-post basis.
Fixes #13473 props solarissmoke.

#12 @nacin
12 years ago

This broke because checkboxes aren't sent when unchecked. #19349

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

#14 @nacin
12 years ago

In [19448]:

Revert [19372] for 3.3. see #13473.

#15 @nacin
12 years ago

  • Milestone changed from 3.3 to Future Release

#16 @linuxologos
12 years ago

  • Cc linuxologos@… added
  • Keywords needs-patch added; has-patch commit removed

#17 @chriscct7
10 years ago

  • Focuses administration added
  • Type changed from defect (bug) to enhancement

#18 @chriscct7
8 years ago

  • Type changed from enhancement to defect (bug)

#19 @archon810
8 years ago

Related: #36462.

Note: See TracTickets for help on using tickets.