} // END - if
// Shall I look for inactive accounts and autopurge inactive accounts?
-if (getConfig('autopurge_inactive') == 'Y') {
+if (isAutopurgeInactiveEnabled()) {
// Init SQLs
initSqls();
// @TODO Rewrite these if() blocks to a filter
$EXCLUDE_LIST = '';
if (isValidUserId(getDefRefid())) $EXCLUDE_LIST .= ' AND `userid` != {?def_refid?}';
+
// Check for more extensions
if (isExtensionActive('beg')) $EXCLUDE_LIST .= ' AND `userid` != {?beg_userid?}';
if (isExtensionActive('bonus')) $EXCLUDE_LIST .= ' AND `userid` != {?bonus_userid?}';
`{?_MYSQL_PREFIX?}_user_data`
WHERE
`status`='CONFIRMED' AND
- `joined` < (UNIX_TIMESTAMP() - {?ap_inactive_since?}) AND
- `last_online` < (UNIX_TIMESTAMP() - {?ap_inactive_since?}) AND
- `ap_notified` < (UNIX_TIMESTAMP() - {?ap_inactive_since?})
+ (UNIX_TIMESTAMP() - `joined`) >= {?ap_inactive_since?} AND
+ (UNIX_TIMESTAMP() - `last_online`) >= {?ap_inactive_since?} AND
+ (UNIX_TIMESTAMP() - `ap_notified`) >= {?ap_inactive_since?}
" . $EXCLUDE_LIST . "
ORDER BY
`userid` ASC", __FILE__, __LINE__);
`{?_MYSQL_PREFIX?}_user_data`
WHERE
`status`='CONFIRMED' AND
- `joined` < (UNIX_TIMESTAMP() - {?ap_inactive_since?}) AND
- `last_online` < (UNIX_TIMESTAMP() - {?ap_inactive_since?}) AND
- `ap_notified` < (UNIX_TIMESTAMP() - {?ap_inactive_time?})
+ (UNIX_TIMESTAMP() - `joined`) >= {?ap_inactive_since?} AND
+ (UNIX_TIMESTAMP() - `last_online`) >= {?ap_inactive_since?} AND
+ (UNIX_TIMESTAMP() - `ap_notified`) >= {?ap_inactive_time?}
" . $EXCLUDE_LIST . "
ORDER BY
`userid` ASC", __FILE__, __LINE__);
if (!SQL_HASZERONUMS($result_inactive)) {
- // Prepare variable...
- $useridsContent = '';
+ // Prepare userid array for admin...
+ $userids = array();
// Delete inactive accounts
while ($content = SQL_FETCHARRAY($result_inactive)) {
// Remember userids for the admin
- $useridsContent .= $content['userid'] . ', ';
+ $useridsContent[] = $content['userid'];
// Get date/time from timestamp
$content['last_online'] = generateDateTime($content['last_online'], 0);
deleteUserAccount($content['userid'], loadEmailTemplate('member_autopurge_delete', $content['last_online'], ''));
} // END - while
- // Remove last comma
- $useridsContent = str_replace(', ', "\n", substr($useridsContent, 0, -2));
+ // Display all userids
+ $useridsContent = implode("\n", $userids);
// Send mail notification to admin
if (getConfig('ap_in_notify') == 'Y') {