Hi All,
As an administrator I want an email from every new post>
In Threads version 6.1 I used this blok in bleu wich I found on this board.
When I paste it in to Version 6.2 it works fine but every time when the mail is send out I see a MySqL error for a few seconds.
What can I do to fix it?
Thanks in advance,
Pim Foppen
[:"blue"] /*
# This code snippet will email every new post to the moderator(s) of the
# forum the post is in, *and* the main administrator of the whole board (user #2).
#
# It mimics the behavior of UBB.Classic.
#
# In addpost.php, insert the code block below directly above the lines:
#
# // ---------------------------------------------
# // Update the total post if the post is Approved
#
#
# Disclaimer: I cobbled this together from existing code,
# I'm using it on my busy board and it works fine for me. I can't and
# won't be responsible if it doesn't work properly for you, or
# for any possible data loss or any incidental damages that may occur,
# etc etc etc legalese. Backup your original files first.
# In other words, use at your own risk, or "modify at your own peril".
#
# I doubt I'll be doing any other work on this since it now does exactly what
# I need it to do, so I'll leave improvements and enhancements to PHP gurus.
#
# That being said, I hope you find it useful, and that someone will
# clean it up and find a way to make it configurable from the Admin
# area, perhaps on a per-forum basis.
#
# This could be made shorter and more efficient by changing prior
# blocks of code, but I decided to make it a snippet to be dropped in,
# so no other modifications are necessary, getting ease of implementation
# but sacrificing a little brevity and efficiency.
#
#
# Helice,
http://foolmoon.com# mailto:
[email protected]#
# June 16, 2002
*/
//-------------Fool Moon Modified-------------------------
$EmailBody = $Body;
$EmailBody = preg_replace("/<([^>])*>/","",$EmailBody);
$newline = "\n";
if (stristr(PHP_OS,"win")) {
$newline = "\r\n";
}
// Find the moderators to notify
$query = "
SELECT Mod_Username
FROM w3t_Moderators
WHERE Mod_Board = '$Board_q'
";
$sth = $dbh -> do_query($query);
$mailer = new mailer;
$header = $mailer -> headers();
$blurb = "has just posted in : ";
// Construct the message body
$msg = "$postername $blurb $Title $newline{$config['phpurl']}/showthreaded.php?Cat=$Cat&Board=$Board&Number=$Mnumber$newline$newline$EmailBody";
// Find the email address for each moderator
while ( list($Mod) = $dbh -> fetch_array($sth)) {
$Mod_q = addslashes($Mod);
$query = "
SELECT U_Email
FROM w3t_Users
WHERE U_Username = '$Mod_q'
";
$sti = $dbh -> do_query($query);
list($to) = $dbh -> fetch_array($sti);
// Mail the package out
mail("$to","$Subject",$msg,$header);
}
// Then find the email address for the main administrator
$query = "
SELECT U_Email
FROM w3t_Users
WHERE U_Number = 2
";
$sth = $dbh -> do_query($query);
list($to) = $dbh -> fetch_array($sth);
// Mail the package out
mail("$to","$Subject",$msg,$header);
//-------------Fool Moon Modified------------------------- [/]