Extension:LastUserLogin

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
LastUserLogin

Release status:Extension status stable

LastUserLogin.png
ImplementationTemplate:Extension#type Special page, User activity
DescriptionTemplate:Extension#description Displays the last time a user logged in
Author(s)Template:Extension#username Justin G. Cramer, Danila Ulyanov, Thomas Klein, Felipe Schenone
Latest versionTemplate:Extension#version 1.3 (2015-03-23)
MediaWikiTemplate:Extension#mediawiki 1.21+
PHPTemplate:Extension#php 5.3+
LicenseTemplate:Extension#license GNU General Public License 3.0 or later
Download
Added rightsTemplate:Extension#rights

lastlogin

Translate the LastUserLogin extension if it is available at translatewiki.net

Check usage and version matrix.

The LastUserLogin extension introduces a special page that displays a simple table of users and the last time they logged in. This can be useful if your wiki is used as a knowledge base for outside personnel. If you have a requirement that they check the wiki prior to placing a call or email, LastUserLogin can be used to verify that this policy is being enforced.

Installation[edit]

  • Download and place the file(s) in a directory called LastUserLogin in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/LastUserLogin/LastUserLogin.php";
    
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Bugfix[edit]

If you encounter Errors while visiting the LastUserLogin-Page like "Cannot use object of type stdClass as array" edit the LastUserLogin.body.php.
Change all $row[ $key ] between Line 106 and 117
to
$row->$key

Usage[edit]

Once installed, visit Special:LastUserLogin to see the times at which each user last logged in. This extension introduces the 'lastlogin' right which is needed to view the special page, and by default is only granted to admins (sysops).

Other info[edit]

Compatibility with removeUnusedAccounts.php

Adding a log entry for every user login impacts the script maintenance/removeUnusedAccounts.php as the script checks for the number of page-edits, image-uploads and log-entries. However you can patch removeUnusedAccounts.php to ignore the first login which is very common for spam bots:

Original:

if ( CountEdits( $user, false ) == 0 && CountImages( $user, false ) == 0 && CountLogs( $user, false ) == 0 ) {
	# User has no edits or images, mark them for deletion
	$del[] = $user;
	$count++;
}

Change to:

if ( CountEdits( $user, false ) == 0 && CountImages( $user, false ) == 0 && CountLogs( $user, false ) <= 1 ) {
	# User has no edits or images, mark them for deletion
	$del[] = $user;
	$count++;
}

See also[edit]