1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-12 11:44:08 +02:00

A reworking of how we handle inactive users

git-svn-id: file:///svn/phpbb/trunk@6394 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Graham Eames
2006-09-23 12:27:51 +00:00
parent 36fa521f92
commit cbece78f7b
15 changed files with 433 additions and 171 deletions

View File

@@ -2330,6 +2330,52 @@ function update_foes()
unset($perms);
}
/**
* Lists inactive users
*/
function view_inactive_users(&$users, &$user_count, $limit = 0, $offset = 0, $limit_days = 0, $sort_by = 'user_inactive_time DESC')
{
global $db, $user;
$sql = 'SELECT user_id, username, user_regdate, user_lastvisit, user_inactive_time, user_inactive_reason
FROM ' . USERS_TABLE . '
WHERE user_type = ' . USER_INACTIVE .
(($limit_days) ? "AND user_inactive_time >= $limit_days" : '') . "
ORDER BY $sort_by";
$result = $db->sql_query_limit($sql, $limit, $offset);
while ($row = $db->sql_fetchrow($result))
{
$row['inactive_reason'] = $user->lang['INACTIVE_REASON_UNKNOWN'];
switch ($row['user_inactive_reason'])
{
case INACTIVE_REGISTER:
$row['inactive_reason'] = $user->lang['INACTIVE_REASON_REGISTER'];
break;
case INACTIVE_PROFILE:
$row['inactive_reason'] = $user->lang['INACTIVE_REASON_PROFILE'];
break;
case INACTIVE_MANUAL:
$row['inactive_reason'] = $user->lang['INACTIVE_REASON_MANUAL'];
break;
}
$users[] = $row;
}
$sql = 'SELECT count(user_id) AS user_count
FROM ' . USERS_TABLE . '
WHERE user_type = ' . USER_INACTIVE .
(($limit_days) ? "AND user_inactive_time >= $limit_days" : '');
$result = $db->sql_query($sql);
$user_count = (int) $db->sql_fetchfield('user_count');
$db->sql_freeresult($result);
return;
}
/**
* Lists warned users
*/