diff --git a/main/inc/global.inc.php b/main/inc/global.inc.php index f03a5eb605..d67a2e3b23 100755 --- a/main/inc/global.inc.php +++ b/main/inc/global.inc.php @@ -544,15 +544,11 @@ if (!isset($_SESSION['login_as']) && isset($_user)) { $sql = "UPDATE $tbl_track_login SET logout_date = '$now' WHERE login_id='$i_id_last_connection'"; Database::query($sql); - // Saves the last login in the user table see BT#7297 - if (isset($_configuration['save_user_last_login']) && - $_configuration['save_user_last_login'] - ) { - $tableUser = Database::get_main_table(TABLE_MAIN_USER); - $sql = "UPDATE $tableUser SET last_login = '$now' - WHERE user_id = ".$_user["user_id"]; - Database::query($sql); - } + + $tableUser = Database::get_main_table(TABLE_MAIN_USER); + $sql = "UPDATE $tableUser SET last_login = '$now' + WHERE user_id = ".$_user["user_id"]; + Database::query($sql); } } diff --git a/main/inc/lib/api.lib.php b/main/inc/lib/api.lib.php index f41884cf46..33b32bd98d 100644 --- a/main/inc/lib/api.lib.php +++ b/main/inc/lib/api.lib.php @@ -1445,29 +1445,9 @@ function _api_format_user($user, $add_password = false) $user_id = intval($user['user_id']); // Maintain the user_id index for backwards compatibility $result['user_id'] = $result['id'] = $user_id; - $saveUserLastLogin = api_get_configuration_value('save_user_last_login'); - - if ($saveUserLastLogin) { - $last_login = $user['last_login']; - } else { - - if (!isset($user['lastLogin']) && !isset($user['last_login'])) { - $timestamp = Tracking::get_last_connection_date($result['user_id'], false, true); - // Convert the timestamp back into a datetime - // NOTE: this timestamp has ALREADY been converted to the local timezone in the get_last_connection_date function - $last_login = date('Y-m-d H:i:s', $timestamp); - } else { - if (isset($user['lastLogin'])) { - $last_login = $user['lastLogin']; - } else { - $last_login = $user['last_login']; - } - } - } - - $result['last_login'] = $last_login; + $result['last_login'] = $user['last_login']; // Kept for historical reasons - $result['lastLogin'] = $last_login; + $result['lastLogin'] = $user['last_login']; // Getting user avatar. diff --git a/main/inc/lib/tracking.lib.php b/main/inc/lib/tracking.lib.php index 179f5902d4..e10b653dfb 100755 --- a/main/inc/lib/tracking.lib.php +++ b/main/inc/lib/tracking.lib.php @@ -5390,25 +5390,23 @@ class Tracking get_lang('Status'), array(1 => get_lang('Active'), 0 => get_lang('Inactive')) ); - if (isset($_configuration['save_user_last_login']) && - $_configuration['save_user_last_login'] - ) { - $form->addElement( - 'select', - 'sleeping_days', - get_lang('InactiveDays'), - array( - '', - 1 => 1, - 5 => 5, - 15 => 15, - 30 => 30, - 60 => 60, - 90 => 90, - 120 => 120, - ) - ); - } + + $form->addElement( + 'select', + 'sleeping_days', + get_lang('InactiveDays'), + array( + '', + 1 => 1, + 5 => 5, + 15 => 15, + 30 => 30, + 60 => 60, + 90 => 90, + 120 => 120, + ) + ); + $form->addButtonSearch(get_lang('Search')); return $form; diff --git a/main/inc/lib/usermanager.lib.php b/main/inc/lib/usermanager.lib.php index 2baa974d65..446e85140d 100755 --- a/main/inc/lib/usermanager.lib.php +++ b/main/inc/lib/usermanager.lib.php @@ -3960,12 +3960,8 @@ class UserManager } if (!empty($lastConnectionDate)) { - if (isset($_configuration['save_user_last_login']) && - $_configuration['save_user_last_login'] - ) { - $lastConnectionDate = Database::escape_string($lastConnectionDate); - $userConditions .= " AND u.last_login <= '$lastConnectionDate' "; - } + $lastConnectionDate = Database::escape_string($lastConnectionDate); + $userConditions .= " AND u.last_login <= '$lastConnectionDate' "; } $courseConditions = null;