Extension ext-coupon continued, a lot improvements applied:
[mailer.git] / inc / daily / daily_birthday.php
index 64e89cebd493c4f782e820c86f123d2e4c62b2f1..7167648dc4815758d461bb038a943bfc10f25d74 100644 (file)
@@ -42,6 +42,7 @@ if (!defined('__SECURITY')) {
        // Do not execute when script is in CSS mode
        return;
 } elseif (!isExtensionActive('birthday')) {
+       // Extension not active/installed
        logDebugMessage(__FILE__, __LINE__, 'Not resetting, needed extension disabled.');
        return;
 }
@@ -54,10 +55,12 @@ $day   = getDay();
 $month = getMonth();
 $year  = getYear();
 
+// Init variable
+$lastOnline = '';
+
 // Shall I include only active members?
-$add = '%s'; $value = '';
-if ((getConfig('birthday_active')) && (isExtensionActive('autopurge')) && (getConfig('autopurge_inactive') == 'Y') && (getApInactiveSince() > 0)) {
-       $add = " AND `last_online` >= (UNIX_TIMESTAMP() - {?ap_inactive_since?})";
+if ((getConfig('birthday_active')  == 'Y') && (isExtensionActive('autopurge')) && (isBegActiveEnabled()) && ((getApInactiveSince() > 0))) {
+       $add = ' AND (UNIX_TIMESTAMP() - `last_online`) >= {?ap_inactive_since?}';
 } // END - if
 
 // Only confirmed members shall receive birthday mails...
@@ -69,10 +72,10 @@ WHERE
        `birth_day`=%s AND
        `birth_month`=%s AND
        `birthday_sent` < (UNIX_TIMESTAMP() - ({?ONE_DAY?} * 364))
-       ".$add."
+       ".$lastOnline."
 ORDER BY
        `userid` ASC",
-       array($day, $month, $value), __FILE__, __LINE__);
+       array($day, $month), __FILE__, __LINE__);
 
 if (!SQL_HASZERONUMS($result_birthday)) {
        // Start sending out birthday mails