The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
|
#1
|
||||
|
||||
![]()
Can anyone help me track down a couple issues with my Email Reminders for inactive users mod? It's been reported that it's sending out emails to members when it shouldn't be, and not sending email when it should be which doesn't make sense.
This SQL statement is supposed to grab all members that have been inactive over x number of days based on their last activity date and have never been sent an email, as long as they can receive emails from the administrator and have not opted out. There is a link in the reminder email which the inactive member may click on to optout. Code:
$sql = "SELECT userid, username, email, usergroupid, ". "FROM_UNIXTIME(lastvisit) lastvisit, ". "FROM_UNIXTIME(lastactivity) lastactivity, ". "CASE WHEN lastpost = 0 THEN '' ELSE FROM_UNIXTIME(lastpost) END AS lastpost, ". "CASE WHEN rmEmailDate = 0 THEN '' ELSE FROM_UNIXTIME(rmEmailDate) END AS lastreminder, ". "TIMESTAMPDIFF(DAY, FROM_UNIXTIME(lastvisit), FROM_UNIXTIME(UNIX_TIMESTAMP())) days_since_lastvisit, ". "TIMESTAMPDIFF(DAY, FROM_UNIXTIME(lastactivity), FROM_UNIXTIME(UNIX_TIMESTAMP())) days_since_lastactivity, ". "CASE WHEN lastpost = 0 THEN 0 ELSE TIMESTAMPDIFF(DAY, FROM_UNIXTIME(lastpost), FROM_UNIXTIME(UNIX_TIMESTAMP())) END AS days_since_lastpost, ". "CASE WHEN rmEmailDate = 0 THEN 0 ELSE TIMESTAMPDIFF(DAY, FROM_UNIXTIME(rmEmailDate), FROM_UNIXTIME(UNIX_TIMESTAMP())) END AS days_since_lastemail, ". "rmoptout ". "FROM " . TABLE_PREFIX . "user ". "WHERE TIMESTAMPDIFF(DAY, FROM_UNIXTIME(lastactivity), FROM_UNIXTIME(UNIX_TIMESTAMP())) >= ". $graceperiod . " ". "AND usergroupid IN ('" . $usergroups . "') ". "AND rmEmailCount = 0 ". "AND options & 16 ". "AND rmoptout = 0 "; $usergroups will be a comma-delimited list of integers (ex. 1','2','3','4 ) If anyone can help, I'll gladly give you credit on the mod page here. ![]() Thanks in advance, Jim |
![]() |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|