Hi!
First of all, thanks for the hack, it really does a great job! There is only one huge problem. Some users are "always", or better "automatically" logged in by their cookies. Thus, the IP addresses of those users are NOT recorded.
Admittedly, I have no clue how this could be achieved, the only idea would be to check if there is a record matching the same ip for a particular user when opening forum_home. This, however, may of course increase database load but is probably suitable for small forums.
Well, I definitely needed that... so I just wrote the required plugin by myself, you may include that in the original addon if you like... please test thoroughly before use!
PHP Code:
$cb_lastknown_ip = $vbulletin->db->query_first("SELECT ipaddress FROM " . TABLE_PREFIX . "logins WHERE userid=" . $vbulletin->userinfo['userid']. " ORDER BY phpdate DESC LIMIT 1");
if ($cb_lastknown_ip['ipaddress'] != IPADDRESS)
{
$vbulletin->db->query_write("INSERT INTO " . TABLE_PREFIX . "logins (userid, username, ipaddress, phpdate, logintype) VALUES (" . $vbulletin->userinfo['userid'] . ", '" . $vbulletin->db->escape_string($vbulletin->userinfo['username']) . "', '" . $vbulletin->db->escape_string(IPADDRESS) . "', " . TIMENOW . ", '$logintype')");
}
unset($cb_lastknown_ip);
I created a new plugin for Log Logins Hack at hook forumhome_start (maybe ..._end would be better... let's see...). Don't forget to activate, use at your own risk.