Make WordPress Core

Opened 16 years ago

Last modified 7 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
Priority: normal Milestone:
Component: Comments Version:
Severity: normal Keywords: needs-patch
Cc: Focuses: administration

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)

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

Download all attachments as: .zip

Change History (21)

#1 @ryan
16 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
16 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
16 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
16 years ago

  • Keywords needs-patch added; comments removed
  • Milestone Awaiting ReviewFuture Release

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

  • Keywords has-patch added; needs-patch removed
  • Milestone Future Release3.3

#7 @solarissmoke
15 years ago

  • Cc solaris.smoke@… added

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

@solarissmoke
15 years ago

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

#9 @ocean90
15 years ago

  • Milestone 3.3Future 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
15 years ago

  • Keywords commit added
  • Milestone Future Release3.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
15 years ago

  • Owner set to westi
  • Resolutionfixed
  • Status newclosed

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
15 years ago

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

#13 @nacin
15 years ago

  • Resolution fixed
  • Status closedreopened

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
15 years ago

In [19448]:

Revert [19372] for 3.3. see #13473.

#15 @nacin
15 years ago

  • Milestone 3.3Future Release

#16 @linuxologos
15 years ago

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

#17 @chriscct7
12 years ago

  • Focuses administration added
  • Type defect (bug)enhancement

#18 @chriscct7
11 years ago

  • Type enhancementdefect (bug)
Note: See TracTickets for help on using tickets.