aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/docs/CHANGELOG.html1
-rw-r--r--phpBB/includes/session.php13
2 files changed, 9 insertions, 5 deletions
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index 3a5ca1bedf..15720cc94e 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -146,6 +146,7 @@
<li>[Fix] Correctly hover list menu in UCP and MCP for rtl languages. (Bug #49945)</li>
<li>[Fix] Correctly orientate quoted text image on RTL languages. (Bug #33745)</li>
<li>[Fix] Deprecate $allow_reply parameter to truncate_string() (Bug #56675)</li>
+ <li>[Fix] Update user's last visit field correctly when changing activation status. (Bug #56185)</li>
<li>[Change] Move redirect into a hidden field to avoid issues with mod_security. (Bug #54145)</li>
<li>[Change] Log activation through inactive users ACP. (Bug #30145)</li>
<li>[Change] Send time of last item instead of current time in ATOM Feeds. (Bug #53305)</li>
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index 933bd47347..11f1896332 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -1361,7 +1361,7 @@ class session
WHERE user_id = ' . (int) $user_id;
$db->sql_query($sql);
- // Update last visit info first before deleting sessions
+ // If the user is logged in, update last visit info first before deleting sessions
$sql = 'SELECT session_time, session_page
FROM ' . SESSIONS_TABLE . '
WHERE session_user_id = ' . (int) $user_id . '
@@ -1370,10 +1370,13 @@ class session
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
- $sql = 'UPDATE ' . USERS_TABLE . '
- SET user_lastvisit = ' . (int) $row['session_time'] . ", user_lastpage = '" . $db->sql_escape($row['session_page']) . "'
- WHERE user_id = " . (int) $user_id;
- $db->sql_query($sql);
+ if ($row)
+ {
+ $sql = 'UPDATE ' . USERS_TABLE . '
+ SET user_lastvisit = ' . (int) $row['session_time'] . ", user_lastpage = '" . $db->sql_escape($row['session_page']) . "'
+ WHERE user_id = " . (int) $user_id;
+ $db->sql_query($sql);
+ }
// Let's also clear any current sessions for the specified user_id
// If it's the current user then we'll leave this session intact