Make WordPress Core

Opened 14 years ago

Closed 9 years ago

Last modified 9 years ago

#12991 closed enhancement (fixed)

Allow setting default_comment_status specifically for Pages (or for any post type)

Reported by: demetris's profile demetris Owned by: messenlehner's profile messenlehner
Milestone: 4.3 Priority: normal
Severity: normal Version: 3.0
Component: Comments Keywords: has-patch
Focuses: Cc:

Description

Now that the default theme has comments_template in Pages too, I have been thinking that maybe we should offer a way of setting default_comment_status specifically for Pages (as distinguished from Posts).

Why?

Say that I select Twenty Ten as my theme. I leave the global option for comments ON, because, like most people, I want comments on my Posts. However, like most people, I do not want comments on Pages, or I want comments only on a few selected Pages. So, every time I make a new Page, I have to untick the checkbox on the Edit screen, in order to override the global setting. That’s not convenient!

I think we need to do something about that:

Either we leave Twenty Ten as is and change something at the level of post type registration, or we change something in Twenty Ten.

(I have no idea what would be a satisfactory way to deal with this at the theme level. Sandbox, for instance, displayed the form on Pages only if there was a certain custom field with a certain value, which may seem very unfriendly at first sight, but I find it is much friendlier than what we have now in Twenty Ten.)

Attachments (2)

default_page_comments.patch (2.2 KB) - added by messenlehner 14 years ago.
Update for setting default comments on or off for pages
default_page_comments2.patch (2.2 KB) - added by messenlehner 14 years ago.
Update for setting default comments on or off for pages

Download all attachments as: .zip

Change History (33)

#1 @greenshady
14 years ago

The previous Default theme just did things wrong. It should've always shown the comments form by default on pages. Twenty Ten just fixes a bug. Changing something in the theme should not be an option at all. The Sandbox theme just adds another level of complexity to something already built in.

I'm impartial to allowing a default for other post types, but a big -1 to changing how this is handled in Twenty Ten.

#2 @mikeschinkel
14 years ago

  • Cc mikeschinkel@… added

@demetris: I agree, the default should be comments on Post and no comments on Pages or any other custom post types. The user should be able to turn on comments for non-Posts, either on a per-post or a global basis but by default only Posts (post_type="post") should have comments. (Note: Post is post_type="post" and post is any post_type.)

IMO, anyway.

#3 @zeo
14 years ago

IMHO, this should be a great addition under Settings > Discussion >
Discussion Settings.

Under Default article settings add another checkbox "Allow people to post comments on new articles Page" or something like that.

#4 @messenlehner
14 years ago

  • Owner set to messenlehner
  • Status changed from new to assigned

Made changes to following files to account for option on Settings > Discussion > Discussion Settings to allow for people to set default open/closed comments on pages:

wp-admin\options-discussion.php #45
wp-admin\includes\post.php #382
includes\post.php #2145

@messenlehner
14 years ago

Update for setting default comments on or off for pages

#5 @messenlehner
14 years ago

  • Keywords has-patch added

@messenlehner
14 years ago

Update for setting default comments on or off for pages

#6 @wpmuguru
14 years ago

(In [14448]) add default comment status setting for pages, props messenlehner, see #12991

#7 @wpmuguru
14 years ago

(In [14451]) add default comment status setting to populate_options(), see #12991

#8 @nacin
14 years ago

  • Keywords ux-feedback added

I think we should revert these and revisit this in 3.1. We need to properly handle an upgrade, for one, also, if we're going to do this, we should consider providing support for custom post types. I know it was committed during the code sprint, but I'm also not sure if this got any ux feedback.

#9 @demetris
14 years ago

There are a couple more issues I’ve noticed after the latest patch:

  1. The explanatory sentence is repeated twice. We only need it once.
  2. The option appears even when it does nothing, i.e., even when the active theme does not support Page comments.

Revisiting all this in v3.1 sounds a reasonable idea at this stage of the release cycle. On the other hand, this is something I would like to see addressed sooner than later, provided we want Twenty Ten to be a theme people will want to use, and will be happy using.

#10 follow-up: @johnonolan
14 years ago

  • Cc john.wp@… added

I agree that a more comprehensive solution should be looked at rather than just bolting on another checkbox

#11 in reply to: ↑ 10 ; follow-up: @demetris
14 years ago

Replying to johnonolan:

I agree that a more comprehensive solution should be looked at rather than just bolting on another checkbox

“bolting on another checkbox”, either at the theme level or at the core level, will be part of any comprehensive solution in any case, since this option must be somehow exposed in the UI.

#12 in reply to: ↑ 11 @johnonolan
14 years ago

Replying to demetris:

Replying to johnonolan:

I agree that a more comprehensive solution should be looked at rather than just bolting on another checkbox

“bolting on another checkbox”, either at the theme level or at the core level, will be part of any comprehensive solution in any case, since this option must be somehow exposed in the UI.

Indeed, but where and what exactly the checkbox does depend on a final functionality spec

#13 @nacin
14 years ago

(In [14650]) Remove default_comment_status_pages setting. Reverts [14451], [14448] for 3.0. see #12991.

#14 @nacin
14 years ago

  • Milestone changed from 3.0 to Future Release

Also [14651].

#15 follow-ups: @demetris
14 years ago

Another problem with the current implementation in WP / Twenty Ten, that I failed to mention before:

If you switch to Twenty Ten from another theme, then comments are turned automatically on for all existing Pages.

#16 in reply to: ↑ 15 @zeo
14 years ago

Replying to demetris:

If you switch to Twenty Ten from another theme, then comments are turned automatically on for all existing Pages.

Obviously the Discussion setting for Allow Comments / pingback for that particular Page is ticked. Need to turn it off individually. That's how it suppose to work.

#17 follow-up: @demetris
14 years ago

@zeo:

That’s exactly the problem:

That, if you want to keep the previous behaviour, you have to go to each one of your Pages and untick an option.

#18 in reply to: ↑ 17 @nacin
14 years ago

Replying to demetris:

@zeo:

That’s exactly the problem:

That, if you want to keep the previous behaviour, you have to go to each one of your Pages and untick an option.

Or use bulk edit and have it done in 10 seconds.

#19 @demetris
14 years ago

@nacin:

Certainly. Bulk edit reduces the inconvenience in this particular case, but bulk edit is not what everyone will think of when they see comment forms on their Pages, and, in any case, that’s not the only issue in the current implementation.

#20 in reply to: ↑ 15 @greenshady
14 years ago

Replying to demetris:

Another problem with the current implementation in WP / Twenty Ten, that I failed to mention before:

If you switch to Twenty Ten from another theme, then comments are turned automatically on for all existing Pages.

This is not a problem with WP / TwentyTen. This is a problem with your previous theme for not properly supporting comments on pages. Comments are not turned on automatically. You just happened to switch to a theme that does things the correct way.

#21 @chipbennett
12 years ago

  • Cc chip@… added

#22 follow-up: @chipbennett
12 years ago

Is this ticket going anywhere, or is it DOA? I would be happy to work on it, if the underlying intent is still acceptable.

I think the correct approach would be to replace default_comment_status with default_comment_status_post, default_comment_status_page, and default_comment_status_attachment (which establishes a convention of default_comment_status_$posttype for CPTs).

Also, the Default article settings text needs to be changed. As far as I know, Posts aren't referred to as Articles anywhere else?

Regarding the UI, I would propose renaming the section from "Default article settings" to "Default comment status", and then provide grouped checkboxes for the following:

Allow people to post comments on:       [ ] Posts
                                        [ ] Pages
                                        [ ] Attachments

Allow link notifications 
(pingbacks/trackbacks) on:              [ ] Posts
                                        [ ] Pages
                                        [ ] Attachments

Attempt to notify blogs linked to from: [ ] Posts
                                        [ ] Pages

...but this would need to be extensible for registered CPTs. (Perhaps through a filter?)

Related: when will the core options-$section.php files be implementing the Settings API? If/when that happens, then custom post type support becomes nothing more than a matter of adding an add_settings_field() call along with the register_post_type() call.

Last edited 12 years ago by chipbennett (previous) (diff)

#23 @jane
12 years ago

  • Keywords ux-feedback removed

@chipbennett: I think your grouped checkboxes proposal looks great. Would love to see that improvement. Not sure if existing patch needs refresh or if it needs to be scrapped and a new one started.

#24 follow-up: @chipbennett
12 years ago

@jane - looks like probably a new patch will be in order.

Do you think I should include all post types (i.e. to include any user-registered post types), or just Posts and Pages (and Attachments)?

#25 in reply to: ↑ 24 @DrewAPicture
12 years ago

  • Cc xoodrew@… added

Replying to chipbennett:

Do you think I should include all post types (i.e. to include any user-registered post types), or just Posts and Pages (and Attachments)?

IANAJ but it would be nice to have support for all post types here, assuming said post types have comments enabled in their supports arrays.

#26 @F J Kaiser
11 years ago

For all people stumbling over this ticket (that hasn't made progress for a while), here's a temporary solution written by a user on WordPress StackExchange.

function wpse48145_unchecked_page_discussion () {
      if( 'page' == $_REQUEST[ 'post_type' ]  ) {
        add_filter( 'pre_option_default_comment_status', 'wpse48145_unchecked_page_discussion_filter' );
        // & if you want...
        add_filter( 'pre_option_default_ping_status', 'wpse48145_unchecked_page_discussion_filter' );
    }
}
add_action( 'load-post-new.php', 'wpse48145_unchecked_page_discussion' );

function wpse48145_unchecked_page_discussion_filter ( $val ) {
    return 'closed';
}

#27 in reply to: ↑ 22 @SergeyBiryukov
11 years ago

Replying to chipbennett:

Also, the Default article settings text needs to be changed. As far as I know, Posts aren't referred to as Articles anywhere else?

Related: #22579

#28 @lkraav
11 years ago

  • Cc leho@… added

#30 @rachelbaker
9 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

#31 @SergeyBiryukov
9 years ago

  • Milestone changed from Future Release to 4.3
Note: See TracTickets for help on using tickets.