WordPress.org

Make WordPress Core

Opened 15 months ago

Last modified 2 months ago

#27111 new enhancement

Turning off global comments should include existing content

Reported by: jenmylo Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.9
Component: Comments Keywords: has-patch
Focuses: administration Cc:

Description

People get confused when they turn off comments on a site, but continue receiving comment notifications. When a user sets the discussion setting to no longer allow comments to be posted to articles, it should turn off new comments on existing posts as well, not just new ones.

http://irclogs.wordpress.org/chanlog.php?channel=wordpress-dev&day=2014-02-12&sort=asc#m790178

Attachments (2)

global-comments-off.diff (4.0 KB) - added by jackreichert 15 months ago.
Provides functionality for global comments flag.
27111.1.diff (2.9 KB) - added by obenland 14 months ago.

Download all attachments as: .zip

Change History (21)

comment:1 @ircbot15 months ago

This ticket was mentioned in IRC in #wordpress-dev by jenmylo. View the logs.

@jackreichert15 months ago

Provides functionality for global comments flag.

comment:3 @jackreichert15 months ago

  • Keywords has-patch added; needs-patch removed

While the IRC discussion seems to imply that fulfilling this ticket should implement function that goes and turns off comments for each post, I thought that perhaps, instead, a new options flag may be cleaner. I tend to prefer to provide options that are not irrevocable. Switching all comments off, one post at a time, is hard to undo.

The attached patch sets up a new option in the options table similar to 'default_comment_status' but would be global.

The only thing missing from the patch is the line:

INSERT INTO  `wordpress`.`wp_options` (`option_name` , `option_value`)
VALUES ('global_comment_status',  'open');

I wasn't sure where/how to add that to the patch.

comment:4 @nacin14 months ago

#12521 was marked as a duplicate.

@obenland14 months ago

comment:5 follow-up: @obenland14 months ago

Added a patch that piggybacks off of _close_comments_for_old_post|s as mentioned in IRC a while back. Additionally makes the label indicate that it toggles status for all articles, not only new ones.

I was not sure how handle the old brace style in new patches. Do we update only in new code, or in the entire function we change?

How set are we on disabling other settings based on the value of default_comment_status?

comment:6 @ircbot14 months ago

This ticket was mentioned in IRC in #wordpress-dev by obenland. View the logs.

comment:7 in reply to: ↑ 5 ; follow-ups: @celloexpressions14 months ago

Replying to obenland:

How set are we on disabling other settings based on the value of default_comment_status?

Based on the direction this is going, I think we can do the following:

  • Toggle-hide the rest of the comment-related settings on the discussion settings page.

I'm not totally clear on this, but I believe it makes sense for this setting to NOT be able to be overwritten on individual posts/pages. If that's the case, in addition to removing the note that says that it can be changed on a per-post basis, we should also hide:

  • "Allow comments" checkbox in QuickEdit
  • Allow comments in Discussion metabox

If there are also no existing comments, then we can hide:

  • The comments admin menu item
  • The comments toolbar item
  • Comments metabox

This essentially hides the entire commenting feature from core, which would be very nice for all those that don't use it (quite possibly a majority).

comment:8 @SergeyBiryukov14 months ago

#17478 was marked as a duplicate.

comment:9 in reply to: ↑ 7 @SergeyBiryukov14 months ago

Replying to celloexpressions:

Based on the direction this is going, I think we can do the following:

  • Toggle-hide the rest of the comment-related settings on the discussion settings page.

Related: #22198

comment:11 in reply to: ↑ 7 @celloexpressions14 months ago

Replying to obenland:

How set are we on disabling other settings based on the value of default_comment_status?

Actually, I think there are two possible approaches: making this option actually turn comments completely off in WordPress (hiding everything; some conditionally if there are existing comments), or allowing them to be turned on for individual posts, in which case I don't think we can hide anything. I think being able to completely turn everything off is the much more common use-case, and allows us to hide a lot of unnecessary UI too. That does go somewhat against the current system, though.

The question, really, is whether it's more useful to have a global default status for comments, or to have a global setting to enable comments at all, where individual posts could disable them as needed. If you're turning off comments on everything, should you be able to turn them back on for certain posts, or should we hide the feature entirely?

Once we figure out the direction here, adding per-post-type support would be a great next step (#12991).

comment:12 @ircbot14 months ago

This ticket was mentioned in IRC in #wordpress-dev by DH-Shredder. View the logs.

comment:13 @DH-Shredder14 months ago

I like the idea of hiding interface if we do make it a global toggle.

That said, since we're this close to 3.9 beta, if that's consensus, I'd suggest a punt so that we can get it right.

obenland: My understanding on the new braces rule is to handle them similarly to whitespace/formatting corrections. If it's a section that's getting modified by a patch, fix 'em up. If it's entirely outside, then avoid changing and causing churn.

comment:14 follow-up: @nacin14 months ago

  • Milestone changed from 3.9 to Future Release

This is not an easy problem to solve. The main issue comes down to the fact that comment_status is really more than two states. Rather than just comments being open and closed for a particular post, they can also be:

  • Closed after a set period of time, something we already handle.
  • Closed site-wide. What happens to existing posts? It's easy to just close all of them (using a filter, not even a DB query) but then what about future posts? Comments should be off by default, but what if someone wanted to enable comments for a particular future post? And then how does that affect existing posts?

I hate the idea of a checkbox that triggers an irreversible DB action. But without the DB action there wouldn't be a way to do this, without an additional state. (Which is possible but probably not doable from a compatibility perspective.)

So at that point here is the implementation I kind of envision:

  • You currently have a mix of posts. Some are 'open', some are manually 'closed', some are in the DB as 'open' but are treated as 'closed' by a filter after a set period of time.
  • You want to disable comments by default for all future posts. Great, those posts get a default of 'closed', rather than 'open'. No problem, that works now.
  • You want to disable comments by default for all current posts, too. How can we do that without forcibly updating all of them to be 'closed'? Store a timestamp in the option. If the post date is earlier than that timestamp, then it's 'closed'.
  • What if you then want to go back and set one of those posts to 'open'? This, I am not sure about. This is where forcibly updating the DB would have been easier, as there's no transient state then. We would need to come up with a new status 'override-open' which forces it to be open, even though a filter has dictated it to be closed.

An alternative is actually running a DB query to set all existing posts (of a particular type, surely) to comment_status = 'closed'. There would be no "undo" for this unless we query for every post ID we're about to update (for which there could be hundreds of thousands or millions) is then saved somewhere. A new meta value on every post is probably prohibitive; it'd need to go into an un-autoloaded option that can then be used for some sort of "undo". Or, they get a "This cannot be undone without doing a really annoying bulk edit" or something.

I would love, love, love to re-do discussion settings, clean it up, separate things out by type, and make all of this happen. But it's not going to happen for 3.9.

comment:15 in reply to: ↑ 14 @jackreichert14 months ago

Replying to nacin:

  • You want to disable comments by default for all current posts, too. How can we do that without forcibly updating all of them to be 'closed'? Store a timestamp in the option. If the post date is earlier than that timestamp, then it's 'closed'.
  • What if you then want to go back and set one of those posts to 'open'? This, I am not sure about. This is where forcibly updating the DB would have been easier, as there's no transient state then. We would need to come up with a new status 'override-open' which forces it to be open, even though a filter has dictated it to be closed.

It the patch I submitted above (#comment:3), instead of changing the functionality of default_comment_status, I added an extra option to the options table: global_comment_status. This way you can close off all comments but it wouldn't effect the specific comment's status.

That solves two problems:
1) Changing the functionality of something that people are expecting to something else.
2) Allowing an undo option.

Just a thought.

Last edited 14 months ago by jackreichert (previous) (diff)

comment:16 @knutsp14 months ago

When comments are globally off it should just disable the comment functionality all together. No other comments options visible, no built-in comments widget, no post-boxes for comments or discussion. Only exception: The then hidden default comment status will be used as before when determining if the comment status should be open or closed in the DB.

When turned on again, all is back as is was before turning it off. Posts added while comments was turned off would have their status determined by the setting of default comment status as seen before comments was turned off.

comment:17 follow-up: @mor102 months ago

We've discussed this at length in the #core-flow NUX group and there is strong consensus that a toggle switch for turning comments hard on and off is needed for new users. Currently there is no clear way for a new user to simply say "I don't want any comments on my site at all". That is problematic.

I agree with all of Nacin's points above, but I don't see an inherent conflict between a global on/off switch and any of the scenarios outlined. In my mind this global switch would sit at a higher level and simply either block all commenting functionality, past and future, or open the options for further detail control. It should not change the status of any existing posts but rather block the ability to add comments at a higher level.

This of course begs the question if disabling comments means actively hiding all previous comments as well as disabling the comment submission form. I'm inclined to say yes. The user need seems to be a simple method for not having comments at all. If they want to be nitpicky about which posts/pages have comments or not they are not looking for a global disable but rather detailed control which is what we have now.

And yes, this might be a bit OT for this ticket. If so let me know and I'll create a new one.

comment:18 @slackbot2 months ago

This ticket was mentioned in Slack in #core-flow by mor10. View the logs.

comment:19 in reply to: ↑ 17 @6templates2 months ago

I totally agree with this. For those who don't want any comment functionality at all on the site, there needs to be a kill switch. It's not a complicated thing as people make it out to be, when you are talking about users who want a site to be free from comment functionality.

Replying to mor10:

We've discussed this at length in the #core-flow NUX group and there is strong consensus that a toggle switch for turning comments hard on and off is needed for new users. Currently there is no clear way for a new user to simply say "I don't want any comments on my site at all". That is problematic.

I agree with all of Nacin's points above, but I don't see an inherent conflict between a global on/off switch and any of the scenarios outlined. In my mind this global switch would sit at a higher level and simply either block all commenting functionality, past and future, or open the options for further detail control. It should not change the status of any existing posts but rather block the ability to add comments at a higher level.

This of course begs the question if disabling comments means actively hiding all previous comments as well as disabling the comment submission form. I'm inclined to say yes. The user need seems to be a simple method for not having comments at all. If they want to be nitpicky about which posts/pages have comments or not they are not looking for a global disable but rather detailed control which is what we have now.

And yes, this might be a bit OT for this ticket. If so let me know and I'll create a new one.

Note: See TracTickets for help on using tickets.