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


Report Post

edited May 2007 in Questions
This discussion is related to the Report Post addon.
Report Post
«1

Comments

  • 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.
  • Works like a charm. Thank you.
  • Wonderful. Love the direct link to comment in the email. Works well as is, still some suggestions (you know me...):

    ISSUE:
    Note: I know I can do this myself in the code (line 22 in default.php:) but these make sense to me: ...id=\"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... ;-)

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

    EMAIL VARIABLES & SUGGESTIONS:
    Add direct link from REPORTERNAME to reporter REPORTERPROFILE
    Add COMMENTPOSTERNAME (+ link to profile)
    Add DISCUSSIONTOPIC
    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*
  • 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 :)
  • 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)
  • 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)

  • *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?
  • 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)

  • 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.

    Later...
    Nope, nothing received.

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

  • 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();
    }
  • 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)

  • 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 domain.com/extensions/ReportPost/report.php?CommentID=REALCOMMENTID and see whether it sends the email then...?
  • 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)

  • Errr, before I start code debugging, have you ticked the necessary report role permissions and user preferences?
  • 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

  • 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

  • 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...
  • 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

  • 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

  • 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?
  • You could just duplicate the extension and change the part of the code which generates the target emails...it shouldn't be that tricky.
  • Uploaded version 1.1 of Report Post with the following changes:
    If the user who reports the post isnt logged in they are referred to as 'guest'.
    The ability to report posts is now granted using role permissions. You WILL need to give roles the permission to report posts if you wish them to be able to do so.
    By default users will not be allowed to report posts. If you wish guests to be able to report posts then you need to open up the default.php, and change the line starting $Configuration['PERMISSION_SEND_POST_REPORT'] to end = 1; instead of = 0;
  • I'm getting: Notice: Undefined property: Context::$User in /home/.pilar/vbunet/xxxxxxx.com/forums/extensions/ReportPost/default.php on line 15 Fatal error: Call to a member function Permission() on a non-object in /home/.pilar/vbunet/xxxxxxx.com/forums/extensions/ReportPost/default.php on line 15
  • Uploaded version 1.1 of Report Post.
  • Ok I've uploaded a new version with the above bug fixed. Sorry about that.
  • Note: I am not a php coder so I will need some hand holding.

    I want this to replace my basically-not-working-notify-extension. What I would like to do is only allow Administrators to report a post (i.e. see the link on the right) yet everyone else be able to receive them. Reason being, there is a lot of conversation on my Project Manager-esque install. Some are important to read and that's when I would want the client to be notified. Not necessarily every time, as a lot of the messages are "thanks" and "this has been received" and "this has been updated." So, it would be nice to choose when they be notified, and this would do the trick.

    How my forum is set up is everything is a whisper. So, its a one on one conversation with myself and the client or my staff and the client, yet the staff can see all whispers. So even though it might be between myself and the client, a member of the staff could also respond and take part in that convo. What I want to happen is for me to post a message and then be able to report that message to the client that its being whispered to.

    How could I accomplish this with this extension?
  • I cant talk you through it right now because it's 3am, I just got in, I'm way to tired to start code digging, and frankly what was a pretty good night took a dramatic turn for the worse about an hour ago. This is not a particularly happy minisweeper. If you'd like to either a) bump this tomorrow morning when I might be a little more interested, b) hope that someone else picks up your question before i get chance and has a quick look for you, or c) drop me an e-mail reminding me (ideally in that order), then it should be pretty easy to work something out for you.
  • Well, here is the bump... the hope... and I guess the email will come later on if necessary : ) Hope your mood improves. Mine is somewhat down as well, but I blame that on Cleveland sports once again disappointing me after they got me all excited.
  • Bumping again... just in case. : /
  • Yeah I got your e-mail. I've got the script open so I'll find time at some point to work out what's required but it's a bit of a background activity for me..
«1
This discussion has been closed.