The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
I have added the option in the User Control Panel to select whether or not you want an email response each time some one replies to a thread you have requested email notifications on or just the one time (as is vBulletin's default).
I have added a row to the User table called allemail and then in the email notification section of the functions.php file I added if ($bbuserinfo['allemail']==0) { $useremails=$DB_site->query("SELECT user.* FROM subscribethread,user WHERE subscribethread.threadid='$threadid' AND subscribethread.userid=user.userid AND user.userid<>'$userid' AND user.lastactivity>'$lastposttime[dateline]'"); } else { $useremails=$DB_site->query("SELECT user.* FROM subscribethread,user WHERE subscribethread.threadid='$threadid' AND subscribethread.userid=user.userid AND user.userid<>'$userid'"); } When they select "No" the value is zero and they should just get one response. If "Yes" they should get a response each time. As it is working now though they get a response each time. So it appears to me that the if statement isn't working and it just defaults to the last statement. Allemail is getting set to 1 or 0 just fine from the user control panel but the script does not appear to recognize the if else routine. Any ideas on how to get this to work? Thanks, Parker |
#2
|
||||
|
||||
![]()
simple debuging skills... "When in doubt, print it out."
![]() print the value of $bbuserinfo['allemail'] |
#3
|
|||
|
|||
![]()
Mark:
Sorry, I am not the great of a coder. How would I go about printing this out? Parker |
#4
|
||||
|
||||
![]()
Is $bbuserinfo available in that function?
|
#5
|
|||
|
|||
![]()
Chen:
It should be. Here is a bit more of the code in question as I have it written into the existing code. Code:
....$lastposttime=$DB_site->query_first("SELECT dateline FROM post WHERE threadid='$threadid' ORDER BY dateline DESC LIMIT ".iif($moderated, '1,1', '1')); // if it's moderated, the post has already been inserted, so we want the one before that if ($bbuserinfo['allemail']==0) { $useremails=$DB_site->query("SELECT user.* FROM subscribethread,user WHERE subscribethread.threadid='$threadid' AND subscribethread.userid=user.userid AND user.userid<>'$userid' AND user.lastactivity>'$lastposttime[dateline]'"); } else { $useremails=$DB_site->query("SELECT user.* FROM subscribethread,user WHERE subscribethread.threadid='$threadid' AND subscribethread.userid=user.userid AND user.userid<>'$userid'"); } $threadinfo[title]=unhtmlspecialchars($threadinfo['title']); $temp = $bbuserinfo['username']; if ($postid) { $postinfo = getpostinfo($postid); $bbuserinfo['username'] = unhtmlspecialchars($postinfo['username']); $bbuserinfo['email'] = unhtmlspecialchars($postinfo['email']); $postemail = $bbuserinfo['email']; } else { if (!$bbuserinfo['userid']) { $bbuserinfo['username'] = unhtmlspecialchars($postusername); $bbuserinfo['email'] = unhtmlspecialchars($postuseremail); $postemail = $bbuserinfo['email']; } else { $bbuserinfo['username'] = unhtmlspecialchars($bbuserinfo['username']); $bbuserinfo['email'] = unhtmlspecialchars($bbuserinfo['email']); $postemail = $bbuserinfo['email']; } } while ($touser=$DB_site->fetch_array($useremails)) { $touser['username']=unhtmlspecialchars($touser['username']); ............................................ Any ideas? Parker |
#6
|
||||
|
||||
![]()
Oh ok I see the problem now, you are coding this the wrong way.
Replace this: Code:
$useremails=$DB_site->query("SELECT user.* FROM subscribethread,user WHERE subscribethread.threadid='$threadid' AND subscribethread.userid=user.userid AND user.userid<>'$userid' AND user.lastactivity>'$lastposttime[dateline]'"); Code:
$useremails=$DB_site->query("SELECT user.* FROM subscribethread,user WHERE subscribethread.threadid='$threadid' AND subscribethread.userid=user.userid AND user.userid<>'$userid'"); Code:
if (!$touser['allemail'] and $touser['lastactivity']<=$lastposttime['dateline']) continue; Code:
while ($touser=$DB_site->fetch_array($useremails)) { |
#7
|
|||
|
|||
![]()
Ok so I would end up with
Code:
$lastposttime=$DB_site->query_first("SELECT dateline FROM post WHERE threadid='$threadid' ORDER BY dateline DESC LIMIT ".iif($moderated, '1,1', '1')); // if it's moderated, the post has already been inserted, so we want the one before that $useremails=$DB_site->query("SELECT user.* FROM subscribethread,user WHERE subscribethread.threadid='$threadid' AND subscribethread.userid=user.userid AND user.userid<>'$userid'"); $threadinfo[title]=unhtmlspecialchars($threadinfo['title']); $temp = $bbuserinfo['username']; if ($postid) { $postinfo = getpostinfo($postid); $bbuserinfo['username'] = unhtmlspecialchars($postinfo['username']); $bbuserinfo['email'] = unhtmlspecialchars($postinfo['email']); $postemail = $bbuserinfo['email']; } else { if (!$bbuserinfo['userid']) { $bbuserinfo['username'] = unhtmlspecialchars($postusername); $bbuserinfo['email'] = unhtmlspecialchars($postuseremail); $postemail = $bbuserinfo['email']; } else { $bbuserinfo['username'] = unhtmlspecialchars($bbuserinfo['username']); $bbuserinfo['email'] = unhtmlspecialchars($bbuserinfo['email']); $postemail = $bbuserinfo['email']; } } while ($touser=$DB_site->fetch_array($useremails)) { if (!$touser['allemail'] and $touser['lastactivity']<=$lastposttime['dateline']) continue; Thanks, Parker |
#8
|
||||
|
||||
![]()
Yes.
|
#9
|
|||
|
|||
![]()
Chen:
Again that did it and again you have helped me out a great deal. Thanks, Parker |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|