sabret00the
04-24-2005, 05:06 PM
Pretty sure i had this working perfectly, hence why no ones moaned about it not working, but it's actually stopped working for me // Get all users who have applied.
$userArray=$DB_site->query("
SELECT AVG(maf_ratings.rating) AS avgrating, maf_application.*, user.username
FROM maf_application
LEFT JOIN maf_ratings ON ( maf_ratings.appid = maf_application.appid )
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = maf_application.userid)
GROUP BY maf_application.appid
");
$threadstuff = $DB_site->query_first("
SELECT *
FROM " . TABLE_PREFIX . "user
WHERE username = '" .$vboptions[maf_username] . "'
");
while ($user=$DB_site->fetch_array($userArray))
{
// Calculate days since joining
$currentday = time();
$daytemp = ($currentday - $user[application_time]) / 86400;
$day = ceil($daytemp);
$username = $user[username];
$userid = $user[userid];
$avg = $user[avgrating];
$auto_mailed = $user[auto_mailed];
$fullname = $user[fullname];
// Email users who we're declining.
if ($day >= 14 AND $avg < 7)
{
vbmail($user[email],"Moderator Application Feedback", "Dear " . $fullname . ",\n\nThank you for your application for the above post of moderator, unfortunately you were unsuccessful at this time.\n\nHowever you\'re presence and input are appreciated, so please try again in the future.\n\nRegards\n\nThe " . $vboptions[bbtitle] . " Team.","From: \"$vboptions[bbtitle] Mailer\" <$vboptions[webmasteremail]>");
echo("Declination Email Sent To ". $user[username] ."<br />");
$declinationemail .= "". $user[username]." ";
if ($declinationemail)
{
$declinationemail .= ", ";
}
$DB_site->query("DELETE FROM maf_application WHERE userid = $userid");
$DB_site->query("DELETE FROM maf_ratings WHERE userid = $userid");
}
// Email users who we're shortlisting.
else
{
if ($day >= 14 AND $avg > 7 AND $auto_mailed != "")
{
// $shorlistemail = $user[username];
vbmail($user[email],"Moderator Application Feedback", "Dear " . $fullname . ",\n\nThank you for your application for the above post of moderator, congratulations you were successfully shortlisted for the role of moderator.\n\nHowever at this time we're unable to directly instate you, your application was exempt and we're short listing you for the next opening, at which point you'll be further contacted by an administrator to let you know if you were successful or not in your application.\n\nYou\'re presence and input are greatly appreciated, so please try keep up the good work.\n\nRegards\n\nThe " . $vboptions[bbtitle] . " Team.","From: \"$vboptions[bbtitle] Mailer\" <$vboptions[webmasteremail]>");
echo("Shortlisting Email Sent To ". $user[username] ."<br />");
$shorlistemail .= "". $user[username]." ";
if ($shorlistemail)
{
$shorlistemail .= ", ";
}
$DB_site->query("UPDATE maf_application
SET auto_mailed = 1
WHERE userid = $userid
");
}
}
it hasn't been sending out the shortlisting emails for some reason :( i tried to fix it but i'm not getting any joy :(
$userArray=$DB_site->query("
SELECT AVG(maf_ratings.rating) AS avgrating, maf_application.*, user.username
FROM maf_application
LEFT JOIN maf_ratings ON ( maf_ratings.appid = maf_application.appid )
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = maf_application.userid)
GROUP BY maf_application.appid
");
$threadstuff = $DB_site->query_first("
SELECT *
FROM " . TABLE_PREFIX . "user
WHERE username = '" .$vboptions[maf_username] . "'
");
while ($user=$DB_site->fetch_array($userArray))
{
// Calculate days since joining
$currentday = time();
$daytemp = ($currentday - $user[application_time]) / 86400;
$day = ceil($daytemp);
$username = $user[username];
$userid = $user[userid];
$avg = $user[avgrating];
$auto_mailed = $user[auto_mailed];
$fullname = $user[fullname];
// Email users who we're declining.
if ($day >= 14 AND $avg < 7)
{
vbmail($user[email],"Moderator Application Feedback", "Dear " . $fullname . ",\n\nThank you for your application for the above post of moderator, unfortunately you were unsuccessful at this time.\n\nHowever you\'re presence and input are appreciated, so please try again in the future.\n\nRegards\n\nThe " . $vboptions[bbtitle] . " Team.","From: \"$vboptions[bbtitle] Mailer\" <$vboptions[webmasteremail]>");
echo("Declination Email Sent To ". $user[username] ."<br />");
$declinationemail .= "". $user[username]." ";
if ($declinationemail)
{
$declinationemail .= ", ";
}
$DB_site->query("DELETE FROM maf_application WHERE userid = $userid");
$DB_site->query("DELETE FROM maf_ratings WHERE userid = $userid");
}
// Email users who we're shortlisting.
else
{
if ($day >= 14 AND $avg > 7 AND $auto_mailed != "")
{
// $shorlistemail = $user[username];
vbmail($user[email],"Moderator Application Feedback", "Dear " . $fullname . ",\n\nThank you for your application for the above post of moderator, congratulations you were successfully shortlisted for the role of moderator.\n\nHowever at this time we're unable to directly instate you, your application was exempt and we're short listing you for the next opening, at which point you'll be further contacted by an administrator to let you know if you were successful or not in your application.\n\nYou\'re presence and input are greatly appreciated, so please try keep up the good work.\n\nRegards\n\nThe " . $vboptions[bbtitle] . " Team.","From: \"$vboptions[bbtitle] Mailer\" <$vboptions[webmasteremail]>");
echo("Shortlisting Email Sent To ". $user[username] ."<br />");
$shorlistemail .= "". $user[username]." ";
if ($shorlistemail)
{
$shorlistemail .= ", ";
}
$DB_site->query("UPDATE maf_application
SET auto_mailed = 1
WHERE userid = $userid
");
}
}
it hasn't been sending out the shortlisting emails for some reason :( i tried to fix it but i'm not getting any joy :(