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.

Report Post

edited May 2007 in Vanilla 1.0 Help
Report Post


  • Options
    Following a lot of requests from various users on this forum, here is an extension which allows you to report a post which you deem to be unacceptable or whatever. It adds a link next to (block user block comment etc) at the side of each post which makes a javascript call to a php file which will send an email to all users who choose to recieve it.

    You can change the text of the email by editing report.txt, and you can use the placeholders COMMENTLINK and REPORTERNAME to add information to the email.

    You must grant ROLES the permission to recieve the emails, and the USERS in the selected ROLES must then select the PREFERENCE to recieve the reports on their forum preferences page.

    Thanks to WallPhone for his Who's Online and Hutstein for his Notify extensions, from which certain code has been taken or followed.

    I have tested it on FF2 on XP though I dont believe there should be any kind of browser incompatability. I have not tested it in great detail but again I dont think there's much to go wrong.

    Try it and let me know what you think.
  • Options
    Works like a charm. Thank you.
  • Options
    Wonderful. Love the direct link to comment in the email. Works well as is, still some suggestions (you know me...):

    Note: I know I can do this myself in the code (line 22 in default.php:) but these make sense to me:\"CommentID_".$Comment->CommentID."\">Report Post</a>";"Report Post" text probably belongs in the definitions to support other language versions.

    While you're there consider:
    - Changing it to lowercase to conform with UI standard in default vanilla theme (so not "Report Post" but "report post")
    - Abbreviating it to "report" to eliminate clutter (link shown each comment, hence intrinsic). Also, my suggestion below would reports both user & post/comment... ;-)

    Confirm report action via JS alert? ("Thank you, this comment has been reported.")

    Add direct link from REPORTERNAME to reporter REPORTERPROFILE
    Add COMMENTPOSTERNAME (+ link to profile)
    Add COMMENTFULLTEXT and/or (COMMENTABSTRACT) to reduce need to *visit* the forum
    Add single-click HIDECOMMENT or DELETECOMMENT variable (links) Note: delete is 'hide' in reality anyhow...

    *edit: added code excerpt*
  • Options
    I considered the confirmatin thing but I wasnt sure how to actually do it...i hacked the JS together with bits and pieces I found elsewhere and it's really beyond the limits of my knowledge...
    That should be in the dictionary you're right. So should the JS popup which checks you want to report it. I'll change those later on tonight if i remember (i could do it now but i'm on the apathetic and lazy part of my night)

    As for the email variables, I guess the link would be easy enough, the others would take a bit more work. Shouldnt be too difficult though. Again i'll do it later if i get round to it. Keep bugging me about it if you want it done ;)

    Cheers for the feedback :)
  • Options
    No worries mate... Just feedback/'wishlisting' (featurecreeping?) here.
    I appreciate all your time/effort... (and I'm never shy asking about things that would make my life easier because I don't have to implement them, hehe)
  • Options
    First I get this...

    Are you sure you want to report this comment? [cancel] [OK]

    Then I get this error in an alert box...

    Failed: (undefined) undefined [OK]

    Posted: Monday, 26 March 2007 at 8:59AM (AEDT)

  • Options
    *blank expression.

    You're running v1.1.2? Tried a hard refresh? Can you check whether the rp.js file is included in the page load?
  • Options
    Yes sir, the rp.js file is on the list!

    As is: /extensions/ReportPost/report.php?CommentID=327&u=1

    Posted: Monday, 26 March 2007 at 10:19AM (AEDT)

  • Options
    I suspect this is a Safari issue, I tested it on Exploder 6.0 and got no error.
    I also get no error in Mac Firefox 2.
    Will check when I get home to see if it actually sent the email.

    Nope, nothing received.

    Edited: Monday, 26 March 2007 at 3:04PM (AEDT)

  • Options
    you want a confirmation if it has sent the message to the admins? well, here you go :)

    function callReport(URL,CommentID,ReportUserID) { if (confirm("Are you sure you want to report this comment?")) { var param = "?CommentID="+CommentID+"&u="+ReportUserID; var dm = new DataManager(); dm.RequestCompleteEvent = finishReport; dm.RequestFailedEvent = HandleFailure; dm.LoadData(URL+param); } } function finishReport() { alert("This comment has now been reported to the forum administrators."); RefreshPage(); }
  • Options
    Thanks Vincent, same error in Safari, no confirmation alert.
    No error in Mac Firefox and I do get your confirmation alert but no email is sent.

    Posted: Monday, 26 March 2007 at 3:40PM (AEDT)

  • Options
    Thanks for that Vincent I'll add that into the code soon. Just out of interest do i actually need to refresh the page? I was only doing it because i couldnt work out how not too (you see what i mean when I say JS aint my strong point? :)

    The method used to send the email uses vanillas inbuilt email classes so if your forum can send other emails then it should be pretty waterproof. A way to test it would be to browse to and see whether it sends the email then...?
  • Options
    Hey Minisweeper, my forum sends applicants' emails OK as well as the Invite Friends extension, it send out the invitations too.

    I tried browsing directly to report.php and, although I got no error, (because the .js was by-passed I suppose), but I received no emails. pic

    Posted: Tuesday, 27 March 2007 at 12:32AM (AEDT)

  • Options
    Errr, before I start code debugging, have you ticked the necessary report role permissions and user preferences?
  • Options
    Um, Allow user to recieve Post Report was not checked for admin, didn't see that in the read-me pic

    No change though, Firefox goes through the motions but no email is sent (at least not received).

    Safari still gives this error...
    Failed: (undefined) undefined [OK]

    Also tried browsing directly to report.php pic

    Posted: Tuesday, 27 March 2007 at 8:18AM

  • Options
    This is weird man, I just found the Recieve Post Report option on each member's Forum Preferences. (Later: because I turned on "Allow user to recieve Post Report" in their role permission).

    I turned mine on and yes I got the email, but why do all the members have the option to receive these reports? (Later: OK, I have now turned that option off for members).

    Surely they should only go to the admins?

    Also, the email received by the admin has a CC to all members who turned the option on, but they don't actually get a copy of the email! Are they supposed to? (Later: Not really an issue, I turned the option off for members)

    The read-me needs work mate :-)

    And... Safari still has the failed: undefined error, but it still sends the email.

    Later still: Should Guests be allowed to report posts? When they do, the report is received as reported by me (admin).

    Last Edited: Tuesday, 27 March 2007 at 9:48AM

  • Options
    Can I assume that the first 2/3 of your post can be scrapped since you worked out that who recieves the email is based on a permission per role and a preference per user basis? Or are you still unclear on that/does that not work right?

    Guests probably shouldnt be allowed to report posts, no. I'll need to stop that from happening.

    No idea what safari's bitching about if it works ok...
  • Options
    Yes my ramblings may be ignored, although some tips in the read-me may save people some hassles?

    I'm trying to disable the error message, not an ideal solution but a work-around so as not to confuse users.

    Posted: Tuesday, 27 March 2007 at 11:12AM

  • Options
    Quote: Minisweeper
    pic Guests probably shouldnt be allowed to report posts, no. I'll need to stop that from happening. pic
    I wrapped the whole default.php script inside this...
    if ($Context->Session->UserID > 0) ..... {
    ...which took the Report Post link away from non-members.

    I also commented this line out in the .js file...
    //dm.RequestFailedEvent = HandleFailure; //Stop error message in Safari
    ...and the cry-wolf error went away.

    Posted: Tuesday, 27 March 2007 at 6:53PM

  • Options
    What I would like to see is one more option. When you click report post, it gives you a choice, report to admin and report to user. I am using my install as a Project Manager. Everything that is on there is a whisper between a client and me, that way I can have 1 category with as many client conversations as I want. So, each conversation is a one on one, and every once in a while, another member of the staff who can view all whispers can come in and say something.

    If a client hits Report Post on their post, it would send me the email (being the admin/moderator). But, if I hit report post on my post, I'd want to have the ability to send it to the client. Basically, to replace the notify extension that currently is not working.

    Your thoughts?
This discussion has been closed.