Gossamer Forum
Home : Products : Gossamer Forum : Development, Plugins and Globals :

Re: [hoefti] Advice on adding functionality

Quote Reply
Re: [hoefti] Advice on adding functionality In reply to
Here's updated code that fixed a couple problems, and should work properly:

Code:
sub {
if ($IN->param('report_post')) {
my ($forum_id, $reporter, $post_id) = @_;
require GForum::Forum;
my $forum = GForum::Forum::get($forum_id);
my $moderators = GForum::Forum->moderators($forum_id)->{forum_moderators};
my @emails = map $_->{user_email}, @$moderators;

# Now @emails contains the e-mail addresses of the forum\'s moderators, if any.

if (!@emails) { # comment out this "if" if you always want the admin to get an e-mail
push @emails, $CFG->{admin_email}; # If no moderators, use the admin e-mail
}

require GT::Mail;
my $reporter_escaped = $IN->escape($reporter);
for (@emails) {
my $mailer = GT::Mail->new(
To => join(', ', @emails),
From => "Moderator Notification <$CFG->{admin_email}>",
Subject => "$forum->{cat_full_name}: $forum->{forum_name} moderator notification",
msg => qq|
$reporter has requested that a moderator be notified regarding about a post in
the $forum->{cat_full_name}: $forum->{forum_name} forum.

The post is located here:
$CFG->{cgi_root_url}/gforum.cgi?post=$post_id#$post_id

User details:
$CFG->{cgi_root_url}/gforum.cgi?username=$reporter_escaped
Forum:
$CFG->{cgi_root_url}/gforum.cgi?forum=$forum_id
|,
($CFG->{smtp_server} ? (smtp => $CFG->{smtp_server}) : (sendmail => $CFG->{mail_path}))
)->send;
}
return { moderator_notified => 1 };
}
else {
return {}
}
}

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com

Last edited by:

Jagerman: Mar 25, 2004, 10:19 AM
Subject Author Views Date
Thread Advice on adding functionality Ishmael 5693 Mar 11, 2004, 12:39 PM
Thread Re: [Ishmael] Advice on adding functionality
Ishmael 5557 Mar 17, 2004, 7:17 AM
Thread Re: [Ishmael] Advice on adding functionality
Jagerman 5554 Mar 17, 2004, 11:03 AM
Thread Re: [Jagerman] Advice on adding functionality
Ishmael 5534 Mar 17, 2004, 12:10 PM
Thread Re: [Ishmael] Advice on adding functionality
Jagerman 5552 Mar 17, 2004, 2:32 PM
Thread Re: [Jagerman] Advice on adding functionality
hoefti 5506 Mar 23, 2004, 9:38 AM
Thread Re: [hoefti] Advice on adding functionality
Jagerman 5476 Mar 25, 2004, 10:17 AM
Thread Re: [Jagerman] Advice on adding functionality
Ishmael 5470 Mar 25, 2004, 3:52 PM
Thread Re: [Ishmael] Advice on adding functionality
Ishmael 5444 Mar 26, 2004, 4:27 PM
Post Re: [Ishmael] Advice on adding functionality
Ishmael 5416 Mar 29, 2004, 6:08 AM
Post Re: [Ishmael] Advice on adding functionality
Jagerman 5410 Mar 30, 2004, 9:07 AM
Thread Re: [Ishmael] Advice on adding functionality
davidnavigator 5109 May 2, 2004, 4:21 AM
Post Re: [davidnavigator] Advice on adding functionality
davidnavigator 5002 Jun 2, 2004, 12:49 AM
Thread Re: [Jagerman] Advice on adding functionality
sangiro 5389 Mar 30, 2004, 2:57 AM
Thread Re: [sangiro] Advice on adding functionality
Jagerman 5395 Mar 30, 2004, 9:24 AM
Post Re: [Jagerman] Advice on adding functionality
hoefti 5094 May 1, 2004, 7:32 PM