Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter
Support for Vanilla Forums Cloud product

In this Discussion

Follow Us


Comment Removal

edited September 2007 in Questions
This discussion is related to the Comment Removal addon.
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.
  • Sorry to bother but how do I enable the settings (for a group)? Cannot find the option in the admin area..
  • Uploaded version 2.1.2 of Comment Removal.
  • oops, in making the js include more selective I managed to forget that it has settings required for the roles pages... fixed now; you should see the options at the bottom of the role page.
  • Thanks for the quick fix, works like charme :)
  • hi, i think you should use
    $Context->SetDefinition(...)
    instead of
    $Context->Dictionary[...] = ...

    Here's a working version wich will get translated correctly in vanilla 1.*:
    $Context->SetDefinition('PERMISSION_REMOVE_COMMENTS', 'Can remove any comment and discussion');
    $Context->SetDefinition('PERMISSION_REMOVE_OWN_COMMENTS', 'Can remove their own comments and discussions (with no replies)');
    $Context->SetDefinition('remove', 'remove');
    $Context->SetDefinition('VerifyDiscussionRemoval', 'Are you quite sure you want to permanently remove this discussion?');
    $Context->SetDefinition('VerifyCommentRemoval', 'Are you quite sure you want to permanently remove this comment?');
  • i have solved my problem
  • This extension contains a serious bug. When removes a whispered comment it does not updates tables DiscussionUserWhisperFrom and DiscussionUserWhisperTo. As a result, vanilla counts comments in discussions incorrectly and makes link to non-existing comments page number.

    For example. We have 50 comments and 1 removed whispered comment. Vanilla will point us to ?page=2 and there are no any comments.
  • Also, this is extension contains SQL error which happerns when you remove whispered comment which is last in discussion. To fix this you should replace


    $DiscFields['TotalWhisperCount'].' = '.($ComInfo['whisper_count'] - 1).',
    '.$DiscFields['WhisperToLastUserID'].' = '.$NextCom['whisperto'].',
    '.$DiscFields['WhisperFromLastUserID'].' = '.$NextCom['whisperuser'].',
    '.$DiscFields['DateLastWhisper'].' = \''.$NextCom['whispercreated'].'\''


    to


    $DiscFields['TotalWhisperCount'].' = '.($ComInfo['whisper_count'] - 1).',
    '.$DiscFields['WhisperToLastUserID'].' = '.(int) $NextCom['whisperto'].',
    '.$DiscFields['WhisperFromLastUserID'].' = '.(int) $NextCom['whisperuser'].',
    '.$DiscFields['DateLastWhisper'].' = \''.$NextCom['whispercreated'].'\''
  • bookmarked. will come back to this when I find the time
  • You don't respect translators and use poor coding. Every time i want to correct YOURS CODE!!! Because translation for my language don't works if in default.php used $Context->Dictionary.

    PLEASE! Use $Context->SetDefinition instead $Context->Dictionary and be hero.

    P.S.
    Why you use $Context->GetDefinition if you don't set any definition ? ;)
«1
This discussion has been closed.