MyBB Community Forums

Full Version: User IP Log
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Link: http://mods.mybb.com/view/user-ip-log
Version: 1.1

Issue:
The plugin installs fine. However, whenever someone actually logs in, the uid logged is always 0 (ie, Guest). I'm assuming either something in the code changed to grab the user's ID or something similar.

The code in the plugin that grabs the user's ID is:
function iplog_exec()
{
    global $user, $db;

    $values = array(
        'uid'       => $db->escape_string( $user['uid'] ),
        'ipaddress' => $db->escape_string( get_ip() ),
        'dateline'  => $db->escape_string( time() )
    );

    $db->insert_query( 'iplogs', $values );
}

The last update to the plugin was August 5th of 2010, I believe for MyBB v1.6. Anyone have an idea how this might be fixed to work properly?

I've tried changing the $user global to $mybb and appending $mybb-> in front of $user['uid'], but then it gives an error when logging in about there being an empty property.

-----

Addendum: It seems it catches uids properly when a user registers, but only then.
Replace the function with:
function iplog_exec()
{
    global $mybb, $db;

    $values = array(
        'uid'       => $db->escape_string( $mybb->user['uid'] ),
        'ipaddress' => $db->escape_string( get_ip() ),
        'dateline'  => $db->escape_string( time() )
    );

    $db->insert_query( 'iplogs', $values );
}
Oddly enough, I tried doing that and it still shows only 'Guest' in the logs (and 0 in the uid field in the database). =/
I downloaded the plugin to test it myself but the default plugin works fine for me. At least for normal logins.
Hmm. I'm presuming it's another plugin conflicting then. Any idea what type of plugin may cause a conflict like that?
What plugins you've installed. Though I don't think that would be plugin conflicting with it.
Try to deactivate all other plugins and see if it works then. If so, enabled them one by one and check with which plugin the problem starts again.
Heh. This may sound crazy, but the culprit is actually the Login Password Conversion plugin. That was the only one that disabling caused the User IP log to work properly. Most peculiar!
I'm not sure how to fix it, though. >.<
Login Password Conversion plugin is too old, and the developement/upgrading of the plugin is ceased too. So issue may rise. There is no need for that plugin too.
Oh! Considering I just converted over to MyBB on a couple of my forums, will it automatically convert over? It's been a few days since I've converted... when I toggle the plugin off, will folks have to reset their password via email to log in?
Pages: 1 2