WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 10 months ago

#8177 closed defect (bug)

Comments disabled in post but not in media gallery — at Version 23

Reported by: canon2k5 Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.7
Component: Gallery Keywords: has-patch
Focuses: Cc:

Description (last modified by lloydbudd)

The options to "allow comments on this post" and "allow trackbacks and pingbacks on this post" have been deselected. The post will then return the expected message "Both comments and pings are currently closed". (ie. http://localhost/wordpress/?p=42) However, when selecting an image from an embedded native Gallery of that post, the image redirects to an attachment_id (ie. http://localhost/wordpress/?attachment_id=38)and still has a comments field. There is no decipherable means to disable comments on attachments through the native gallery.

If this is the expected behavior, I would believe that if a post may disable comments, then all of its content should be disabled.

Related: #9839 Enable/Disable comments on a per item bases (some attachments don't have parents)

Change History (24)

comment:1 ryan5 years ago

What theme are you using? This is probably a theme bug.

comment:2 janbrasna5 years ago

  • Cc janbrasna added
  • Keywords image gallery attachment commenting discussion preference added

Confirming the bug in 2.7-beta3-9922 however not sure about possible solutions. Should commenting preferences be inherited from the attachment's parent post? Or set explicitly per attachment?

comment:3 janbrasna5 years ago

  • Keywords dev-feedback 2nd-opinion added
  • Milestone changed from 2.8 to 2.7

comment:4 westi5 years ago

  • Keywords reporter-feedback added; dev-feedback 2nd-opinion removed

Please let us know what theme you are using.

comment:5 DD325 years ago

I dont think its a theme bug, Well, If it is, Its because the bug exists in the default theme.

<?php if ('open' == $post->comment_status) : ?>

The theme only checks that the current post's(attachment) comment status is open, And closing the status on a parent doesnt follow through to children.

A potential solution would be to do a lookup on the parent and check its comment_status, and set the attachment to the same during the query.

comment:6 ryan5 years ago

  • Milestone changed from 2.7 to 2.8

We should add parent checking to pings_open() and comments_open() and encourage themes to use those. There is no time to do this for 2.7, however. Postponing to 2.8.

comment:7 janbrasna5 years ago

The problem probably starts at the point when the attachment's data is pulled from DB to $post since both comment_status and ping_status are set to open in DB.

The question is, wouldn't it be better to explicitly set the pings&comments for individual attachments directly?

comment:8 DD325 years ago

  • Keywords needs-patch added

DD325 years ago

comment:9 DD325 years ago

  • Keywords has-patch needs-testing added; image gallery attachment commenting discussion preference reporter-feedback needs-patch removed

attachment 8177.diff added.

  • Sets comment/ping status to the parent posts status for attachments
  • Supports themes which use if ('open' == $post->comment_status) instead of comments_open()
  • Note, The changes to _close_comments_for_old_posts are so the closed-comments-on-the-fly work for the front page commenting links.. Included in this patch simply for review sake, The functionality for this ticket works without it.

comment:10 DD325 years ago

  • Keywords tested dev-feedback added; needs-testing removed

Any traction?

comment:11 Denis-de-Bernardy5 years ago

i'm not a big fan of this patch. imo, the open/closed status for comments should have an additional value, inherit, which does just that.

comment:12 Denis-de-Bernardy5 years ago

  • Keywords commit added

then again, it's better than the current behavior...

comment:13 azaozz5 years ago

Currently comments on attachments respect the close_comments_for_old_posts setting. Perhaps all that's needed is to check whether comments are open on the parent post when outputting an attachment post.

comment:14 dd325 years ago

Perhaps all that's needed is to check whether comments are open on the parent post when outputting an attachment post.

Thats pretty much what the patch does.. Except, It does it when the attachment post object is loaded, so that it also affects front-page links instead of incorrectly showing "Comment now!" when comments are closed.

comment:15 hakre5 years ago

Hmm, isn't that a configuration issue? I mean, the attachment actually has comments according to the comment settings data. Shouldn't the date be set properly while updating the parent post? Or can attachment be shared between multiple posts and therefore there is need to handle that dynamically?

comment:16 dd325 years ago

. Shouldn't the date be set properly while updating the parent post?

the parent posts's setting can be dynamic, Ie. Close old comments doesnt change it in hte DB, it happens on the PHP-level to reduce database load.

comment:17 Denis-de-Bernardy5 years ago

  • Keywords early added
  • Milestone changed from 2.8 to 2.9

Punting per IRC discussion.

Things have been this way for months, it can stay that way for another few months. A minuscule plugin can fix it in the meanwhile.

comment:18 hakre5 years ago

I just checked. The default behavior is that (genreal option to allow comments is set to on), that when you create a post and add a gallery (wether or not the post has comments switched on in post settings) the attachments _ever_ have the option to comment on.

I would not only suggest to move this request into the plugin domain but into the theme domain. If this bevhavior is not intented, the theme must check for the attachements if the parent post allows comments or not.

The other route would be to extend the attachment editor having it's own comment setting input controls. Having or not that feature should clarify wether that is wanted or not.

See current patch for some code fragments on how to check for attachemnts parent open status.

Personally, I do not want to loose the ability to have comments on attachments but not on the parent post.

Resolve as "won't fix"?

comment:19 dd325 years ago

  • Keywords 2nd-opinion added; has-patch tested commit early removed

2.9 will get some media attention i believe.

I'd like to see an option added in 2.9 for the settings, as in, "Attachments inherit parents pingback/commenting settings" with per-image(& possible per-gallery) comment/pingback handling as well.

Leaving this open for discussion in 2.9 depending on where the UI goes.

comment:20 Denis-de-Bernardy5 years ago

  • Keywords needs-patch added; dev-feedback 2nd-opinion removed

let's leave it open then

comment:21 azaozz4 years ago

  • Milestone changed from 2.9 to 3.0

Most media changes will be in 3.0

comment:22 dd324 years ago

  • Milestone changed from 3.0 to Future Release

Punting again, due to limited traction on the media items.

comment:23 lloydbudd4 years ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.