1

Topic: Notify moderator of each post

Does anybody know how to modify 1.2 so that I can get a copy of each post?

Thanks.

Re: Notify moderator of each post

Have you tried to search such mod at punres.org?

3

Re: Notify moderator of each post

Yes, I looked at two notification mods. They required a huge number of edits, and I couldn't get the one I tried to work -- maybe no longer worked in my 1.2.x version.

Anyway, none of the mods really do what I need, which is one simple task:

Just send a copy of every post to the admin or moderators. I tried a few hours editing the subscriber and post scripts in PunBB, but I couldn't get it working because I don't have enough knowledge of the code.

Thanks for any hints or code snippets.

Re: Notify moderator of each post

This code will send notifications about new post. Add this code after the line 208 in <FORUM_ROOT>/post.php. Replace the <LANGUAGE> and <EMAIL> parameters with those you need. I haven't tested this code myself, there may be some errors.

$mail_tpl_full = trim(file_get_contents(PUN_ROOT.'lang/'.<LANGUAGE>.'/mail_templates/new_reply_full.tpl'));
$first_crlf = strpos($mail_tpl_full, "\n");
$mail_subject_full = trim(substr($mail_tpl_full, 8, $first_crlf-8));
$mail_message_full = trim(substr($mail_tpl_full, $first_crlf));

$mail_subject_full = str_replace('<topic_subject>', '\''.$cur_posting['subject'].'\'', $mail_subject_full);
$mail_message_full = str_replace('<topic_subject>', '\''.$cur_posting['subject'].'\'', $mail_message_full);
$mail_message_full = str_replace('<replier>', $username, $mail_message_full);
$mail_message_full = str_replace('<message>', $message, $mail_message_full);
$mail_message_full = str_replace('<post_url>', $pun_config['o_base_url'].'/viewtopic.php?pid='.$new_pid.'#p'.$new_pid, $mail_message_full);
$mail_message_full = str_replace('<board_mailer>', $pun_config['o_board_title'].' '.$lang_common['Mailer'], $mail_message_full);

pun_mail(<EMAIL>, $mail_subject_full, $mail_message_full);

5

Re: Notify moderator of each post

Slavok wrote:

This code will send notifications about new post. Add this code after the line 208...


Many Thanks. I tried it, but it seems that the code is not run. I tested by doing:

system("echo $mytext > /path/to/file.txt");

Nothing is written. I moved the echo test further up in post.php, and then it wrote the text to the test file.

Also, the odd thing is that pun_mail(...) never sends anything even at the top of post.php, BUT when I subscribe to a topic it sends the mail. I guess the code is just in the wrong place?

What is different after subscribing to a topic? (I'm using SMTP, btw).

Thanks,

Marcus