Make WordPress Core

Opened 16 years ago

Closed 12 years ago

Last modified 10 years ago

#8177 closed defect (bug) (wontfix)

Comments disabled in post but not in media gallery

Reported by: canon2k5's profile 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)

Attachments (4)

8177.diff (3.2 KB) - added by DD32 16 years ago.
8177.2.diff (6.4 KB) - added by obenland 12 years ago.
8177.3.diff (7.7 KB) - added by obenland 12 years ago.
8177.4.diff (7.7 KB) - added by obenland 12 years ago.

Download all attachments as: .zip

Change History (39)

#1 @ryan
16 years ago

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

#2 @janbrasna
16 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?

#3 @janbrasna
16 years ago

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

#4 @westi
16 years ago

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

Please let us know what theme you are using.

#5 @DD32
16 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.

#6 @ryan
16 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.

#7 @janbrasna
16 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?

#8 @DD32
16 years ago

  • Keywords needs-patch added

@DD32
16 years ago

#9 @DD32
16 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.

#10 @DD32
16 years ago

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

Any traction?

#11 @Denis-de-Bernardy
16 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.

#12 @Denis-de-Bernardy
16 years ago

  • Keywords commit added

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

#13 @azaozz
16 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.

#14 @dd32
16 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.

#15 @hakre
16 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?

#16 @dd32
16 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.

#17 @Denis-de-Bernardy
16 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.

#18 @hakre
16 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"?

#19 @dd32
16 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.

#20 @Denis-de-Bernardy
16 years ago

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

let's leave it open then

#21 @azaozz
15 years ago

  • Milestone changed from 2.9 to 3.0

Most media changes will be in 3.0

#22 @dd32
15 years ago

  • Milestone changed from 3.0 to Future Release

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

#23 @lloydbudd
14 years ago

  • Description modified (diff)

#24 @iandstewart
14 years ago

With probable media enhancements in 3.3 is there any chance of this making someone's todo list?

@obenland
12 years ago

#25 @obenland
12 years ago

  • Keywords has-patch added; needs-patch removed

Refreshed @dd32's patch.
Since 3.5 is almost out the door, maybe this could be something for 3.6?

The issue is still current, the patch still works! :)

#27 @SergeyBiryukov
12 years ago

  • Milestone changed from Future Release to 3.6

#28 @SergeyBiryukov
12 years ago

If we're removing $query->is_singular() check, I guess the $query parameter (added in [18836]) should be removed as well, since it's not used anywhere else.

#29 @obenland
12 years ago

Nice catch. I updated the patch.

@obenland
12 years ago

#30 @SergeyBiryukov
12 years ago

"10, 2" in line 190 of default-filters.php should also be removed.

@obenland
12 years ago

#31 @obenland
12 years ago

Updated patch.

#32 @ocean90
12 years ago

Related: #12991, #17478

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

#33 @obenland
12 years ago

I talked with ocean90 in IRC about it and we agree that we should probably not add that functionality after all.

Since 3.5, attachments can not only be attached to more than one post, but they now also offer the ability to change their discussion settings individually, on a per attachment basis.

What do you think, Sergey?

#34 @obenland
12 years ago

  • Milestone 3.6 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Closing. Since 3.5, discussion settings can be adjusted on a per attachment basis.

#35 @wonderboymusic
10 years ago

#19858 was marked as a duplicate.

Note: See TracTickets for help on using tickets.