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

NickENickE New
edited September 2007 in Vanilla 1.0 Help
Comment Removal
«1

Comments

  • Just installed it and tried it out (V2.1), but when I did "remove" on a discussion it hangs a bit (green dots animated) and then opens a small error-window with "error: " (blank, no other text).

    I didn't have any older Version before.

    Any ideas?
  • This works for me OK, has done since the start.
    Is it a JavaScript error?
    Maybe it can't find the file?
  • hmmm, no idea. i use the "green" theme and the "Deutsch" language. the error-popup only says "error: " so i have no idea, if it ist javascript. there's a yellow icon left to the "error:".
    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!
  • just in case someone wonders:
    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 ;-)
  • ok, i'm a bit stupid. of course i still have to hide the discussion. not only the comment/post. so that works now.

    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?
  • It doesn't delete the attachment-files from the server. Is it not supposed to do that, or is it possible to bake that into this extension?

    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.
  • in the near future, this Dojo Files will help you out there ;)

    (shameless whoring of my own extension :P)
  • That sounds very promising :)
  • Has anyone tried Mod-ing this Add-on so that it just deletes/hides the post/discussion instead of removing it from the database?
    Sirnot, Have you ever done this variation of your Add-on?
  • [edited] Nevermind, figured it out already. :)
  • When I delete a private discussion to myself, the "discussions started" count in my profile page stays the same. Shouldn't the 'discussions started' be updated as well, after a discussion has been deleted?
  • jeffk do you realise that the base install of vanilla provides exactly that behaviour?
  • Only for admins and mods, as far as I can tell. There are delete comments and delete discussions permissions, but they are for anyone's comments and discussions. I can't find any settings anywhere that will allow normal members to delete (delete as in hide) their own comments.
  • @Minisweeper

    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.
  • On another note, the javascript is included on all pages, which seems a bit unessesary. Perhaps a check like this could be added: if($Context->SelfUrl == 'comments.php' && $Context->Session->UserID > 0) { all the funky stuff, including the AddScript }
  • +1 for bjrn, as stated in this page every extension coder should try to pay attention to this.

    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?
  • grahack, this would be quite doable, you could probably rip the code for it straight from my clever edit extension for determining the last comment and for removing buttons and enforcing restrictions on certain comments, though it might be a little more complex.
  • hmm, good point about the javascript, I seemed to have forgotten that...

    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).
  • Uploaded version 2.1.1 of Comment Removal.
  • Ok thanks to you two for the "last comment only" overview.
This discussion has been closed.