-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautotask.php
More file actions
33 lines (31 loc) · 1.13 KB
/
autotask.php
File metadata and controls
33 lines (31 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/**
* Function for removing users that have not activated their accounts
*
* @copyright http://www.impresscms.org/ The ImpressCMS Project
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License (GPL)
* @package Administration
* @subpackage Autotasks
*/
/**
* Deletes users who registered but aren't yet active for X days.
*
* To be used in ImpressCMS 1.2
* @return mixed Did the query succeed or not? Returns nothing if succeeded, false if not succeeded
*/
function remove_usersxdays() {
$db = icms_db_Factory::instance();
global $icmsConfigUser;
$days = $icmsConfigUser['delusers'];
$delete_regdate = time() - ($days * 24 * 60 * 60); // X days/month * 24 hrs/day
$sql = sprintf("DELETE FROM %s WHERE (level = '0' AND user_regdate < '%s')", $db->prefix('users'), $delete_regdate);
if (!$result = $db->queryF($sql)) {
return false;
}
}
/*
* Here comes the part for removing inactive users after X days.
* I used to ad it here, because it is always loaded within core loading.
* I also made a condition to run the function, only when system is not doing a GET action!
*/
remove_usersxdays();