The "Last Seen" column currently sorts by the "changed" timestamp found in the "users" table. However, this doesn't always accurately reflect when a user last visited a site. This patch modifies the module so last seen gets sorted by the last time the user viewed a page, as logged by the statistics module.
This module will work with or without the statistics module enabled. If statistics module is disabled, the module will continue to work as before.
IMPORTANT: If you install this module over an existing installation, you must change/reset the module's settings to display the "lastseen" column.
| Comment | File | Size | Author |
|---|---|---|---|
| members.patch | 2.82 KB | Steve Dondley |
Comments
Comment #1
Steve Dondley commentedI've discovered this code doesn't scale to well with a large access log table. Please let me know if you have any ideas on how to make the code more efficient.
Comment #2
walkah commentednot sure that it would scale *that* much better... but the timestamp on the session might be a better bet (i.e. this is what the "who's online" block uses as well.
does that sound better?
Comment #3
Steve Dondley commentedI'm not sure how the sessions table exactly works, but looking at the data, it doesn't appear to keep records for very long. They seem to get deleted after a certain amount of time.
Comment #4
Steve Dondley commentedI will be uploading a patch shortly that simply does a query for each user. While it's counterintuitive, it actually runs much quicker than the single query used in the patch.
Comment #5
neablo commentedhow do i force the members module to sort the members by "last seen" and not by "roles" ?
Comment #6
junyor commentedWouldn't it make sense to fix the 'changed' date in Core rather than hacking around this here?
Comment #7
junyor commentedI think 4.7 solves the "last seen" issue by changing the column in the users table to "access" rather than "changed". Furthermore, http://drupal.org/node/66532 fixes this problem for 4.7.