]> git.mxchange.org Git - mailer.git/blobdiff - inc/filter/bonus_filter.php
Bonus mails are now editable, duplicate message ids cleaned up:
[mailer.git] / inc / filter / bonus_filter.php
index b72d994b6c20ec9b848e4533f72ad070ae96b80d..d4cf091b80c56faf4df7fa4a1b26906a9400160b 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,26 @@ 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;
+}
+
+// Filter for generating admin mail links for bonus mails
+function FILTER_GENERATE_BONUS_MAIL_LINKS ($data) {
+       // Is the type 'bid'?
+       if ($data['type'] == 'bid') {
+               // Load template
+               $data['__output'] .= loadTemplate('admin_links_bonus_mail', true, $data);
+       } // END - if
+
+       // Return data
+       return $data;
 }
 
 // [EOF]