wholemama
04-18-2006, 03:41 PM
I've got this plugin I've been trying to write for newpost_complete...but I can't get it to work...anyone see where I've gone wrong?
//if post is original author
$originals = $vbulletin->db->query_read("
SELECT postuserid
FROM " . TABLE_PREFIX . "thread
WHERE threadid = '" . $newpost['threadid'] . "'");
while($original = $vbulletin->db->fetch_array($originals)) {
if($original['userid']==$newpost['userid']){
//Find who is subscribed to this thread
$subscribed = $vbulletin->db->query_read("
SELECT emailupdate,userid
FROM " . TABLE_PREFIX . "subscribethread
WHERE threadid = '" . $newpost['threadid'] . "'");
while($subscribe = $vbulletin->db->fetch_array($subscribed)) {
if ($subscribe['emailupdate'] == 5) {
//User is subscribed to thread & wants notification when original replies
//Get users email address and name
$user = $vbulletin->db->query_first("
SELECT email,username
FROM " . TABLE_PREFIX . "user
WHERE userid = '" . $subscribe['userid'] . "' LIMIT 1");
// Get email phrases
eval(fetch_email_phrases('foruminstantnotify', $forum['languageid']));
//Send the email
vbmail($user['email'], $subject, $message);
}
}
}}
//if post is original author
$originals = $vbulletin->db->query_read("
SELECT postuserid
FROM " . TABLE_PREFIX . "thread
WHERE threadid = '" . $newpost['threadid'] . "'");
while($original = $vbulletin->db->fetch_array($originals)) {
if($original['userid']==$newpost['userid']){
//Find who is subscribed to this thread
$subscribed = $vbulletin->db->query_read("
SELECT emailupdate,userid
FROM " . TABLE_PREFIX . "subscribethread
WHERE threadid = '" . $newpost['threadid'] . "'");
while($subscribe = $vbulletin->db->fetch_array($subscribed)) {
if ($subscribe['emailupdate'] == 5) {
//User is subscribed to thread & wants notification when original replies
//Get users email address and name
$user = $vbulletin->db->query_first("
SELECT email,username
FROM " . TABLE_PREFIX . "user
WHERE userid = '" . $subscribe['userid'] . "' LIMIT 1");
// Get email phrases
eval(fetch_email_phrases('foruminstantnotify', $forum['languageid']));
//Send the email
vbmail($user['email'], $subject, $message);
}
}
}}