Updated: Comment #44
Problem/Motivation
Users cannot delete their own comments if they do not have permission to delete comments. Allowing users to unconditionally edit/delete their comments can lead to broken or incomprehensible threads if users change their original posts once other users have replied to them.
Preventing users from deleting comments at all leads to a few issues:
- Duplicate posts cannot be removed by end-users
- Users expect to be able to delete comments that they have very recently posted
Proposed resolution
Allow comments to be configured so that users can delete their own comments if no further replies have been posted to the thread that may be in response to that comment.
Remaining tasks
- Decide whether this behaviour should be default, controlled globally by permissions or a combination of permissions and field level configuration
- Patch
- Followup issue: Allowing users to "delete" comments that have replies by replacing the body of the comment with a "this comment has been deleted" notice
- Followup issue: Allow editing of comments without replies
- Followup issue: Ability to "flatten" threaded comments
User interface changes
Users will see a link that allows them to delete comments that have no replies.
API changes
It's possible a new permission will be added to manage the new behaviour.
Original report by @ixis.dylan
It would be great if users could delete their own comments. It would reduce the number of double-posts and is expected by a lot of forum users.
A feature request for this feature request would be a configurable time limit after which comments can no longer be deleted (or edited).
Comment | File | Size | Author |
---|---|---|---|
#41 | d8-delete_own_comment-10700-41.patch | 7.7 KB | marthinal |
#14 | comment-delete-own.patch | 8.62 KB | nedjo |
#10 | comment.patch | 2.07 KB | gildedgod |
Comments
Comment #1
jakeg CreditAttribution: jakeg commentedI agree. My users who've migrated from vBulletin want the 'delete post' (i.e. delete own comments) ability. This should/could be added as an access control permission?
Comment #2
ixis.dylan CreditAttribution: ixis.dylan commentedThis relies on somebody submitting code to work around the "delete one comment in a thread without destroying the whole thread" problem.
Comment #3
Wesley Tanaka CreditAttribution: Wesley Tanaka commentedPerhaps... Or more simply for a lot of forums some kind of comment flattening procedure, which would remove threading from comments before doing this kind of operation. On my site, the UI for replying to a comment (instead of the first forum post directly) isn't even exposed, so I'm pretty confident that all my forum posts don't have any threading in their replies.
Comment #4
pfaocleNot really a viable solution, in my opinion: surely site maintainers would want threaded, um, threads to stay threaded?
The ideal would be to join any child comments of a deleted comment to its parent.
Comment #5
webchickAn interim solution could be to allow users to delete comments with no threads beneath them (there should be a separate permission for this). If the comment has children, then delete is forbidden apart from administrators.
Or, use JavaScript to disable the submit button upon clicking it to try and prevent double-posts. I'm not crazy about a JS solution but I've seen it used in other software packages.
Comment #6
Wesley Tanaka CreditAttribution: Wesley Tanaka commentedI certainly don't want that for comments on forum posts. I in fact went through some effort to try to prevent people from creating threaded comments on forum posts. And I think this probably holds for some sizeable fraction of site admins that want forums on their site. For my forums, a flattening procedure would be nice independent of whether or not an editor could delete a comment, as I've just installed quote.module, which appears to have again exposed a link through which someone can create a reply to a comment instead of to the node.
Comment #7
dan_aka_jack CreditAttribution: dan_aka_jack commentedWe too went to some effort to "flattern" our forums: ukfilm.org/forum
I agree that, in my experience, the vast majority of forums are flat. Personally, I think threading-within-a-thread is messy and should be disabled by default. Half the users on a threaded forum probably don't understand that they're posting to a thread-within-a-thread instead of the main thread.
Personally, I think it's a _good_ idea to let users delete duplicates but I think it's a _bad_ idea to let users delete any other sort of post. Sometimes, especially in heated arguments, immoral users have been known to manipulate what they said earlier in the conversation.
Comment #8
dan_aka_jack CreditAttribution: dan_aka_jack commentedFirst off: I must correct a typo in my post above.
Instead of "I think it's a _good_ idea to let users duplicates" I meant to type "I think it's a good idea to let users delete duplicates..." (sorry for the typo)
Instead of allowing users to delete "normal" posts, I have submitted a new issue suggesting that we let users edit comments for up to an hour after posting. This would allow the correction of typos but would prevent users from editing previous comments if the discussion gets heated.
Comment #9
geodaniel CreditAttribution: geodaniel commentedI think the first step for this should just be to add a permission to allow people to delete their own comments as long as there have been no subsequent replies added as children to that comment.
Comment #10
gildedgod CreditAttribution: gildedgod commentedSolved for Drupal 5.5
// $Id: comment.module,v 1.520.2.12 2007/11/07 08:03:30 drumm Exp $
> Adds a permission to allow people to delete their own comments as long as there have been no subsequent replies added as children to that comment.
The way I do it:
1) add a new link to comments ("comment_delete_own" links to "comment/delete_own/$comment->cid") where user is author of comment and there is no replies
2) add page callback ("comment_delete_own" on "comment/delete_own/") for users with "post comments'" permission calls to "comment_delete_own" function
3) add function "comment_delete_own", which checks that user is author of comment and there is no replies. If it is so - evaluates standard admin comment deletion procedure by executing confirm dialog "comment_confirm_delete"
Code needs review.
Comment #11
StevenPatz5.x is feature frozen.
Comment #12
gildedgod CreditAttribution: gildedgod commented@spatz4000: but the problem it still alive. I solved it for my own site... maybe, someone else will found this code useful =)
Comment #13
nedjoHere's an untested patch for HEAD.
Approach:
* Introduce a new delete op in
comment_access()
, which works the same as the existing edit one--users can delete their own comments provided there are no replies.* In
comment_menu()
, follow the same approach for delete as for edit. That is, everyone with 'post comment' permission has access to the menu item but in the callback we load the comment and test for access.* Move
comment_delete()
and related functions from comment.admin.inc to comment.pages.inc because the are now accessed by non-admins.* Adapt
comment_delete()
to callcomment_access()
to test for delete access.* In the delete confirm for and confirmation submit handler, customize messaging according to whether user has administer 'comments' permission and hence is able to delete threads.
Comment #14
nedjoWith patch.
Comment #15
taqwa CreditAttribution: taqwa commentedHey gilded!
Thanks for this wonderful patch. The only problem is that I get a white screen once the comment has been deleted. Do you have this issue as well? If so, any idea on how I can fix it?
Thanks
Comment #16
drawk CreditAttribution: drawk commentedPatch still applies with offset. I didn't experience any of the white screen problems mentioned by Lukas2000 while testing.
Worked as described. I was able to delete comments as an authenticated user, so long as there were no replies to that comment. Deleting all replies to a comment (as admin) makes the original comment delete-able again by the poster, just as it seems it should.
Comment #17
beeradb CreditAttribution: beeradb commentedJust tested, and my initial comment threw an error.
To reproduce:
1). Get a clean installation of drupal with this patch installed.
2). Create a page, with comments set to Read/Write.
3). Post a comment to the page you've just created.
4). Click the delete link.
5). Get presented with a Page not found error.
Comment #18
beeradb CreditAttribution: beeradb commentedComment #19
drawk CreditAttribution: drawk commentedHmm, I am unable to reproduce the page not found error on my side, following exactly those steps
(fresh checkout of HEAD, create a page, comments set to Read/Write, post a comment, click delete link). I get re-directed back to the node with my comment deleted.
Anyone else willing to take this for a spin?
Comment #20
beeradb CreditAttribution: beeradb commentedMoving back to CNR to try and get another person or two to provide feedback on what I reported.
Comment #21
JaccoViljoen CreditAttribution: JaccoViljoen commentedIs this patch tested and working on Drupal 6.6?
Comment #22
StevenPatzprobably not, as things are generally fixed in the latest version and then backported back.
Comment #23
Anonymous (not verified) CreditAttribution: Anonymous commentedThe last submitted patch failed testing.
Comment #24
jyg CreditAttribution: jyg commentedn/m
Comment #25
gildedgod CreditAttribution: gildedgod commentedBecause this issue became relevant to drupal 7, I moved my own patch for drupal 5.x to another node: http://drupal.org/node/350488
Comment #26
Dave Reid@gildedgod That's just how the issue queues work. Feature requests are only accepted into the development version of Drupal, 7.x. You can post a patch for others to use, but unless it is a critical bug fix, it usually will not get accepted for D5 or D6.
Comment #27
kenorb CreditAttribution: kenorb commentedTrue, on 6.x users can't delete their own comments.
In which # I'll find patch for 6.x?
Comment #28
VM CreditAttribution: VM commentedThere is no patch for Drupal 6.x in this thread. A patch will be created for Drupal 7.x. If the desired functionality is found to work as expected and if it can be, it will be back ported to Drupal 6.x.
Comment #29
Ingumsky CreditAttribution: Ingumsky commentedSubscribing. It' be very useful for my users (on Drupal 6.x)
Comment #30
v8powerage CreditAttribution: v8powerage commentedAny hopes for backporting patch to 6 soon?
Comment #31
k3vin CreditAttribution: k3vin commented+1
Comment #32
DjC4 CreditAttribution: DjC4 commentedWould love a patch for this on six. My comments and forums have been flattened. So when I delete one comment it won't delete all comments related to it or after it. I'd love to give users the ability to delete their own posts.
Comment #33
v8powerage CreditAttribution: v8powerage commentedI was thinking that if this feature will be eventually implemented it should require flatcomments module to be present
Comment #34
jsgammato CreditAttribution: jsgammato commented+1
I need threaded discussions, but forbidding deletion after there is a reply is OK.
Comment #35
andrenoronha CreditAttribution: andrenoronha commentedI use usercomments to let the node owner to delete the comments to the node. but i'd like to let the author of the comment to delete it....
is it possible in drupal 6?
Comment #36
andrenoronha CreditAttribution: andrenoronha commentedi installed the module comment delete, gave the right permissions (delete own comment to authenticated user) but i still get the access denied page....
any idea?
Comment #37
dixon_Comment #38
ShadowMonster CreditAttribution: ShadowMonster commentedI use Comment Access for D7 and would like also let users delete own comments meaningless to with node are attached
subscribe
Comment #39
Media Crumb CreditAttribution: Media Crumb commentedAny news on this. Going against almost all other forum software on the planet is just plain silly.
Comment #40
mototribe CreditAttribution: mototribe commentedThe comment goodness module promises to do just that: http://drupal.org/node/1540924
Comment #41
marthinal CreditAttribution: marthinal commentedThis is a very old issue so I added a patch + test where we have a permission to delete own comment only if this comment hasn't a reply.
Comment #42
mototribe CreditAttribution: mototribe commentedI'm using a "soft delete" feature where I unpublish a comment rather than deleting it. Any comment can be soft deleted, even with replies.
Comment #43
ceardach CreditAttribution: ceardach commentedI started to review the patch in comment 41 by marthinal, but it just ended up with me thinking about a lot of the issues here, so I'm going to just throw in my recommendations of how this should be handled.
First of all, I do believe this should be handled in core. I started thinking about how to do it "right" and it would be best to work directly with the comment system itself instead of trying to layer on top of it.
I also believe that a full solution to this problem will need two permissions: delete any own comments, and delete own unreplied-to comments. It can be argued that people who want to delete their comments that are at a tail of a thread can do that. It can also be argued that once someone has replied, that comment should be permanent. And it can be argued that even if someone has replied to a comment, the original can be deleted if desired. Adding these two delete-comment permissions will give site builders decent flexibility to choose what is best for them.
Deleting comments at the tail of a thread is technically easier to do, which marthinal has provided a patch for. As for deleting a comment that has replies, I have seen others implement that as replacing the entire comment with a [deleted] note, and all replies are threaded underneath. Example:
I recommend using the [deleted] method. The next thing to consider is if the user should still be associated with the deleted comment or not -- and I would recommend having that as a global toggle display option, while the user remains associated with the deleted comment in the database.
Also, I think there needs to be some thought around the UX when people can delete some of their comments and not others (such as in the case of preventing the delete when the comment has replies). In that case, I think the "delete" should show up in the list of links, but it should provide a message that deleting is prevented due to the replies (e.g.: a "disabled link" with hover help text).
Marthinal's patch does not satisfy all needs of this problem, but it's a good step forward.
Comment #44
thedavidmeister CreditAttribution: thedavidmeister commentedOk, so I've read over this thread.
Firstly, @ceardack, you should have set this to "needs work" as your review presents a few valid points that need following up. The idea of replacing comments with a [deleted] note should be a followup issue, really.
Secondly, I disagree that this should be a global permission and should be more configurable than that - most likely at the field level now that Comments settings are a field - https://drupal.org/node/2100015
I'm setting this to "active" so that there can be further discussion about what should actually be included in the patch.
Thirdly, patch no longer applies:
I've updated the issue summary.
I like this idea so I'm going to give it a #2094585: [policy, no patch] Core review bonus tag from this review, so hopefully if we get a new patch this issue won't languish un-reviewed for another full year.
Comment #45
ixis.dylan CreditAttribution: ixis.dylan commentedHappy Birthday!
Comment #46
andypostLooks this feature is not very popular, anyway 8.0.x closed for features
Comment #56
XLD CreditAttribution: XLD commentedI was shocked to find out today that users cannot delete their own comments so I stumbled across this thread. As some of you have mentioned, I believe simply changing the content of the comment to "This comment has been deleted." and same for the author of the comment (in case the commenter does no longer wish to be associated to the comment) is more than a decent solution. This way the existing threads will not loose their logic. For unthreaded comments, the comment can be deleted completely I suppose.
Comment #61
chucksimply CreditAttribution: chucksimply commentedSetting the issue to active to hopefully revive some interest and traction on the patch. With the number of sites using comments these days, it seems neccesary to have some sort of "delete own comment" functionality.
Can we start with some simple logic?
If a user deletes their own comment and...
Thoughts?