]> git.mxchange.org Git - mailer.git/blobdiff - inc/filter/bonus_filter.php
Description made more clear
[mailer.git] / inc / filter / bonus_filter.php
index b72d994b6c20ec9b848e4533f72ad070ae96b80d..34ee4408088f4b53a315aaec6fb6d24aebb631fb 100644 (file)
@@ -41,8 +41,9 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Filter for adding login bonus to the user's account
-function FILTER_ADD_LOGIN_BONUS () {
+function FILTER_ADD_LOGIN_BONUS ($data) {
        // Is the user data valid?
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
        if (!isMember()) {
                // Do only run for logged in members
                debug_report_bug(__FUNCTION__, __LINE__, 'Please only run this filter for logged in users.');
@@ -59,7 +60,7 @@ SET
        `last_login`=UNIX_TIMESTAMP()
 WHERE
        `userid`=%s AND
-       `last_login` < (UNIX_TIMESTAMP() - {?login_timeout?})
+        (UNIX_TIMESTAMP() - `last_login`) >= {?login_timeout?}
 LIMIT 1',
                        array(
                                getMemberId()
@@ -73,10 +74,14 @@ LIMIT 1',
        if (($bonus === true) && (getRequestParameter('mode') == 'bonus')) {
                // Output message with added points
                $GLOBALS['message'] .= '<div class="tiny">{--MEMBER_BONUS_LOGIN_BONUS_ADDED--}</div>';
-       } elseif (isExtensionActive('bonus')) {
+       } else {
                // No login bonus added!
                $GLOBALS['message'] .= '<div class="notice">{--MEMBER_BONUS_LOGIN_BONUS_NOT_ADDED--}</div>';
        }
+
+       // Return data
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
+       return $data;
 }
 
 // [EOF]