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 11181 Mar 11, 2004, 12:39 PM
Thread Re: [Ishmael] Advice on adding functionality
Ishmael 10946 Mar 17, 2004, 7:17 AM
Thread Re: [Ishmael] Advice on adding functionality
Jagerman 10939 Mar 17, 2004, 11:03 AM
Thread Re: [Jagerman] Advice on adding functionality
Ishmael 10930 Mar 17, 2004, 12:10 PM
Thread Re: [Ishmael] Advice on adding functionality
Jagerman 10952 Mar 17, 2004, 2:32 PM
Thread Re: [Jagerman] Advice on adding functionality
hoefti 10897 Mar 23, 2004, 9:38 AM
Thread Re: [hoefti] Advice on adding functionality
Jagerman 10866 Mar 25, 2004, 10:17 AM
Thread Re: [Jagerman] Advice on adding functionality
Ishmael 10859 Mar 25, 2004, 3:52 PM
Thread Re: [Ishmael] Advice on adding functionality
Ishmael 10858 Mar 26, 2004, 4:27 PM
Post Re: [Ishmael] Advice on adding functionality
Ishmael 10795 Mar 29, 2004, 6:08 AM
Post Re: [Ishmael] Advice on adding functionality
Jagerman 10809 Mar 30, 2004, 9:07 AM
Thread Re: [Ishmael] Advice on adding functionality
davidnavigator 10502 May 2, 2004, 4:21 AM
Post Re: [davidnavigator] Advice on adding functionality
davidnavigator 10386 Jun 2, 2004, 12:49 AM
Thread Re: [Jagerman] Advice on adding functionality
sangiro 10776 Mar 30, 2004, 2:57 AM
Thread Re: [sangiro] Advice on adding functionality
Jagerman 10770 Mar 30, 2004, 9:24 AM
Post Re: [Jagerman] Advice on adding functionality
hoefti 10485 May 1, 2004, 7:32 PM