Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Comment Removal
NickE
New
Comment Removal
0
This discussion has been closed.
Comments
I didn't have any older Version before.
Any ideas?
Is it a JavaScript error?
Maybe it can't find the file?
i don't want to try it out too often, in order not to make too many damage:
i removed a discussion which was hidden, got the error, clicked on the (should-be-removed) discussion to "unhide" it and then clicked "hide" again, but now others can see and click on the discussion, but there's only the header shown, without the first comment.
in my admin-account (where i can see hidden discussions and comments) i still see the first comment, but with a small text-notice (i translate from german:) "this comment was hidden from (me) before xx hours"
maybe this helps someone in thinking about the solution.
thanx in advance!
yes, i have two fields, one "delete" and one "remove".
i used the "delete" to hide/unhide and tried the "remove" to remove, so there's no mismatch from the "user's" side ;-)
next is, it has really something to do with javascript (the remove-button), because when i try to remove a post using the browser "opera", the system error message hat "javascript" in the title. do i have to change any options in the browser?
Otherwise (as far as I can see) you'll have a troublesome job going over the attachments and deleting the database entries for attachments belonging to deleted comments.
(shameless whoring of my own extension :P)
Sirnot, Have you ever done this variation of your Add-on?
Yes, but it's per role, not per user, and full access to delete any post. I am looking for a per-user way to their own posts/discussions on their end. This extension works great but I'd rather keep the post in the database if possible.
if($Context->SelfUrl == 'comments.php' && $Context->Session->UserID > 0) { all the funky stuff, including the AddScript }
Feature or feature request ?
I don't have much time to test this extension now, but is ANY comment removable? I'd love my users to be able to remove a comment only if this comment is the last of a discussion. What do you think?
And yes, if you enable the settings, users will be able to remove their own comments and, when there are no replies, discussions. Modifying it to only allow users to remove their comment only if it is the last one should be a relatively trivial manner: in CommentOptions_AddDeleteButton, you can check the comment # (note that that's the number in the discussion, /not/ the id) against the total number of comments to determine if the comment is last (eg.
$IsLastComment = ($GLOBALS['CommentGrid']->CurrentPage - 1) * $GLOBALS['Context']->Configuration['COMMENTS_PER_PAGE'] + $Form->DelegateParameters['RowNumber'] == $GLOBALS['CommentGrid']->Discussion->CountComments;
); in ajax.php, you can modify the sql query so as to retrieve any comments (which are valid to that user) that have a CommentId greater than or equal to the one in question (naturally ordering by id asc), then check if you have more than one result (>1 result indicates comments with a greater id have been found, and hence this one isn't the last).