Gossamer Forum
Quote Reply
Notify Moderator
Heya,

(I tried a search and couldn't find anything so I hope I'm not repeating something here)

Has anyone devised a global or plugin that will enable users to send a quick PM to a forum moderator when they see a "bad" post, by simply clicking on a link on the post? I know this feature exist and quite a few other forum software apps.

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] Notify Moderator In reply to
Doesn't anything exist for this already? Something like "report a bad post" .. I thought it was a standard feature :/

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Notify Moderator In reply to
Quote:
Doesn't anything exist for this already? Something like "report a bad post" .. I thought it was a standard feature :/

Not that I'm aware of....

Safe swoops
Sangiro
Quote Reply
Re: [sangiro] Notify Moderator In reply to
My company will be doing this modification fairly soon since it's a necessity for us.

Muhammad
Quote Reply
Re: [sangiro] Notify Moderator In reply to
I don't have this set up as a plug in as I am not as familiar on how to program it as such, but I have gotten the notify moderator to work via the GForum system.

Here are the steps I took to do so:

1. Created 2 globals
Code:

NotifyMods

sub {
my $forum_id = $IN->param('forum');
my $post_id = $IN->param('post');
my $username = $IN->param('username');
my $post_subject = $IN->param('subject');
return {forum_id => \$forum_id,
post_id => \$post_id,
post_subject => \$post_subject,
username => \$username,
email => ""};
}

Code:

ConfirmNotifyMods

sub {
my $forum_id = $IN->param('forum_id');
my $post_id = $IN->param('post_id');
my $username = $IN->param('username');
my $post_subject = $IN->param('post_subject');
my $email = $IN->param('email');
my $reason = $IN->param('reason');
my $subject = qq~Moderator Notification on Post #$post_id~;
my $message = qq~
$username has reported the post: $post_subject.
Reason Provided: $reason
This post can be located at: http://www.yoursite.com/...um.cgi?post=$post_id
~;
require GT::Mail;
$CFG->{smtp_server} or $CFG->{mail_path} or return 'No mail path or SMTP server set!';
my $mailer = GT::Mail->new(
to => $email,
subject => $subject,
from => $CFG->{admin_email},
msg => $message
);
local $@;
eval {
$mailer->send($CFG->{smtp_server} ? (smtp => $CFG->{smtp_server}) : (sendmail => $CFG->{mail_path}))
} or return "Unable to send Notification: " . ($@ || $mailer->error);
"Thank you - Notifications sent";
}


2 - Created two templates
Code:

NotifyMods.html

<%--
File
====
NotifyMods.html
Description
===========
When someone clicks on the Notify Mod link they are presented this page.
This confirms that they want to send the notification and provides for a "reason". After this is submitted the system sends an email to the moderators of the forum.
--%>
<html>
<head>
<title><%site_title%>: Notify Moderators of this Post</title>
<%include include_css.html%>
</head>
<%body_tag%>
<center>
<%include include_header.html%>
<%body_table%>
<%NotifyMods%>
<form method="post" action="gforum.cgi">
<%hidden_form%>
<input type="hidden" name="do" value="ConfirmNotifyMod">
<input type="hidden" name="username" value="<%username%>">
<input type="hidden" name="post_id" value="<%post_id%>">
<br><br>
Forum: <%forum_id%> <input type="hidden" name="forum_id" value="<%forum_id%>"> <br>
Post Subject: <%post_subject%> <input type="hidden" name="post_subject" value="<%post_subject%>"> <br>
<%GForum::Forum::moderators($forum_id)%>
<%if forum_num_moderators%>
Moderators:
<%loop forum_moderators%>
<%nbsp user_username%><%unless last%>,<%endunless%>
<%set email .= $user_email%>
<%set email .= ','%>
<%endloop%>
<%endif%><br>
<input type="hidden" name="email" value="<%email%>">
Email Addresses: <%email%><br>
<br>
Reason for Notification: <input type="text" name="reason" size=65 value=""> <br><br><br>
<input type="submit" value="Send Notification" class="submit">
</form>
<%/body_table%>
<br><br>
<%include include_footer.html%>
</center>
</body>
</html>

Code:

ConfirmNotifyMods.html

<%--
File
====
ConfirmNotifyMods.html
Description
===========
This bring confirmation page for a notification sent to a mod(s).
--%>
<html>
<head>
<title><%site_title%>: Notified Moderators</title>
<%include include_css.html%>
</head>
<%body_tag%>
<center>
<%include include_header.html%>
<%body_table%>
<br>
<br><br><h3>
<%ConfirmNotifyMods%>
</h3><br><br><%/body_table%>
<br><br>
<%include include_footer.html%>
</center>
</body>
</html>


3. Created two actions

ConfirmNotifyMod (pointing to ConfirmNotifyMods.html page with minimum user set to registered user)
NotifyMods (pointing to NotifyMod.html page with minimum user set to registered user)
*Note - set to minimum user to prohibit abuse of link

4. Added link to include_post_display template
Code:

<%if current_user_id%>
<a href="gforum.cgi?do=NotifyMods&forum=<%forum_id%>&username=<%current_user_username%>&post=<%post_id%>&subject=<%post_subject%><%hidden_query%>" target="_blank">Report Post to Moderator</a>
<br><%endif%>


If you do not set to only show to those with user ids then two things could happen:
- abuse of the link by guest
- search engines may follow the link setting off emails to the moderators

We went this way versus PM because we have multiple moderators assigned to forums and this is an easy way to send one message to X # of moderators at once. Also, we wanted to ensure that the moderators were aware even if they did not have access to our forum at the time - most have access to their email all of the time (i.e. at work, etc.). We could also customize the message a little easier.

It uses the GForum internal notification so it is all set up based on existing variables. Initially we went straight to the send function, but the moderators provided feedback that some people had hit the link in error. Also they wanted to allow the user to provide feedback as to why the user had decided to report (i.e. spam, wrong forum, etc.).


Herpeton
VegPeople.com