SiT! Bugs

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000395SiT!otherpublic2009-01-11 16:382009-08-16 14:38
Reporterpaulh 
Assigned Toivan 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target Version3.50Fixed in Version3.50 
Summary0000395: Variable for last seen
DescriptionWe should have a global variable similar to $now for last seen calculation as its hard coded in a number of places and would be difficult to change if necessary (it also means there could be differences throughout SiT in its calculation)
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
User avatar (0000473)
ivan (administrator)
2009-01-11 16:43

Theres the function user_online()

Is this not good enough?
User avatar (0000475)
paulh (administrator)
2009-01-11 18:03

Not really as a group_selector has a "All Online" option and this a number of places have SQL hardcoded for calculating last see e.g. users.php:



if ($onlineonly === 'true' OR $filtergroup === 'allonline' )
{
    $sql .= "AND lastseen > NOW() - (60 * 30) ";
}
User avatar (0000707)
ivan (administrator)
2009-03-04 18:17

I think it's ok to have that in several places but the 30 shouldn't be hardcoded it should use the session length variable
(0000969)
DimKir (reporter)
2009-04-23 10:13

version 3.45.
MySQL error (column 'lastseen').

I changed user_add.php (lines 237-243):
        $sql = "INSERT INTO `{$dbUsers}` (username, password, realname, roleid,
                groupid, title, email, phone, mobile, fax, status, var_style,
                holiday_entitlement, user_startdate, lastseen) ";
        $sql .= "VALUES ('$username', '$password', '$realname', '$roleid',
                '$groupid', '$jobtitle', '$email', '$phone', '$mobile', '$fax',
                1, '{$CONFIG['default_interface_style']}',
                '$holiday_entitlement', '$startdate',NOW())";
User avatar (0000970)
ivan (administrator)
2009-04-23 10:20

Thanks DimKir, but is that what we want do you think? That will make it look as if newly added users are online right now?
(0000971)
DimKir (reporter)
2009-04-23 10:40

Sorry for wrong code, I had to quickly correct the problem with MySQL error :-)

Now I change the code back and reproduced the problem:
Application Error [256]
MySQL Query Error Field 'lastseen' doesn't have a default value in user_add.php @ line 245 trigger_error()
User avatar (0000972)
ivan (administrator)
2009-04-23 11:37

Ah I didn't see that error. I've gone with your suggestion and changed it to use NOW() it's better than an error message at least and it probably doesn't matter that the user shows online for a short time after user creation.
User avatar (0000973)
ivan (administrator)
2009-04-23 12:11

Added a new variable $startofsession which is the current time less the length of user sessions. If lastseen is greater than this time we can assume the user is online.

trunk svn r5346
User avatar (0001610)
ivan (administrator)
2009-08-16 14:38

Released in 3.50rc1

- Issue History
Date Modified Username Field Change
2009-01-11 16:38 paulh New Issue
2009-01-11 16:43 ivan Note Added: 0000473
2009-01-11 16:43 ivan Status new => feedback
2009-01-11 18:03 paulh Note Added: 0000475
2009-03-04 18:17 ivan Note Added: 0000707
2009-03-04 18:17 ivan Assigned To => ivan
2009-03-04 18:17 ivan Status feedback => assigned
2009-03-04 18:17 ivan Target Version => 3.50
2009-04-23 10:13 DimKir Note Added: 0000969
2009-04-23 10:20 ivan Note Added: 0000970
2009-04-23 10:40 DimKir Note Added: 0000971
2009-04-23 11:37 ivan Note Added: 0000972
2009-04-23 12:11 ivan Note Added: 0000973
2009-04-23 12:11 ivan Status assigned => resolved
2009-04-23 12:11 ivan Resolution open => fixed
2009-04-23 12:11 ivan Fixed in Version => Current SVN
2009-08-16 13:17 ivan Fixed in Version Current SVN => 3.50
2009-08-16 14:38 ivan Note Added: 0001610
2009-08-16 14:38 ivan Status resolved => closed


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker