diff --git a/inc/inc.ClassSession.php b/inc/inc.ClassSession.php index 78f796a0b..a9940d938 100644 --- a/inc/inc.ClassSession.php +++ b/inc/inc.ClassSession.php @@ -473,8 +473,11 @@ class SeedDMS_SessionMgr { * * @return array list of sessions */ - function getUserSessions($user) { /* {{{ */ + function getUserSessions($user, $limit=0) { /* {{{ */ $queryStr = "SELECT * FROM `tblSessions` WHERE `userID`=".$user->getID(); + $queryStr .= " ORDER BY `lastAccess` DESC"; + if($limit > 0) + $queryStr .= " LIMIT ".(int) $limit; $resArr = $this->db->getResultArray($queryStr); if (is_bool($resArr) && $resArr == false) return false;