Extension talk:UserLoginLog/Archive

In case this is not obvious, go to your Special:Log/UserLogin page to query the results logged.

Patch for MediaWiki 1.71+
The call for User::newFromId($user->getID); doesn't seem to exist in 1.71, so the fix is to add a function that creates this data... Add this function to the UserLoginLog.php extension code:

function newFromId( $id ) { $u = new User; $u->mId = $id; $u->mFrom = 'id'; return $u; }

Then change the wfUserLoginLogout fuction to look like this:

function wfUserLoginLogout(&$user) { global $wgUserBeforeLogout; $wgUserBeforeLogout = newFromId($user->getID); return true; }

-- David Greenberg, 03/12/2008 12:44PM CDT

Logout was not working
I found out, that a logout wouldn't create a log entry im my mediawiki, so i changed the two following functions:

function wfUserLoginLogout(&$user) { global $wgUserPage, $wgUserName; $wgUserPage = $user->getUserPage; $wgUserName = $user->getName; return true; } function wfUserLoginLogoutComplete(&$user) { global $wgUserPage, $wgUserName; $log = new LogPage('userlogin', false); $log->addEntry('logout', $wgUserPage, $wgUserName); return true; }

For me it also seems to be the nicer solution for this problem.

--12:14, 19 January 2009 (UTC)