Log in

View Full Version : Need Help - Using newpost_complete


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);
}
}
}}

wholemama
05-01-2006, 12:48 AM
Bumping out of desperation...

Xenium
05-01-2006, 03:02 AM
Replace the where clauses in your SQL statments in the following way.

change: WHERE threadid = '" . $newpost['threadid'] . "'");

change to: WHERE threadid = $newpost['threadid']");

do it like that for all of them.

wholemama
05-03-2006, 01:34 PM
Thanks...that seems to do something...

Except now, I always get a "this is a duplicate of a post you did in the last 5 minutes" message. It's like it double posts.