// Is the 'bonus' extension installed and activated?
if (isExtensionActive('bonus', true)) {
// Check for bonus campaigns
- $result = SQL_QUERY_ESC("SELECT `id`, `points` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `data_type`='SEND' AND timestamp <= %s ORDER BY `id`",
+ $result = SQL_QUERY_ESC("SELECT `id`, `points` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `data_type`='SEND' AND `timestamp` <= %s ORDER BY `id` ASC",
array(bigintval($PURGE)), __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Start deleting procedure
// Add points from deleted accounts to jackpot, but here just add to notify mail
if ($admin_points > 0) {
// Send mail to admin
- sendAdminNotification(getMessage('AUTOPURGE_ADMIN_SUBJECT'), 'admin_autopurge_points', translateComma($admin_points), 0);
+ sendAdminNotification(getMessage('AUTOPURGE_ADMIN_SUBJECT'), 'admin_autopurge_points', translateComma($admin_points));
} // END - if
// Run all SQLs here