Extension:ShowRealUsernames/ShowRealUsernames.php

<?php
/**
 * ShowRealUsernames MediaWiki extension
 *
 * To activate this extension, add the following into your LocalSettings.php file:
 * require_once('$IP/extensions/ShowRealUsernames/ShowRealUsernames.php');
 *
 * @file ShowRealUsernames.php
 * @ingroup Extensions
 * @package MediaWiki
 * @version 1.2
 * @license public domain
 * @author Paul Lustgarten
 * @author John Erling Blad
 * @author RV1971
 * @link https://www.mediawiki.org/wiki/Extension:ShowRealUsernames Documentation
 */

# Not a valid entry point, skip unless MEDIAWIKI is defined
if( !defined( 'MEDIAWIKI' ) ) {
  echo "ShowRealUsernames: This is an extension to the MediaWiki package and cannot be run standalone.\n";
  die( -1 );
}

# By default, allow everybody to see real names in ShowRealUsernames
$wgGroupPermissions['user']['showrealname'] = true;

/*
 * List of extra fields to get from user record. These fields are
 *substituted for $1, $2 etc. in messages. For compatibility with
 *older versions, user_real_name is the first and user_name the second
 *field, even if the opposite might be considered more intuitive.
 */

$wgShowRealUsernamesFields = array( 
	'user_real_name',
	'user_name', 
	'user_email'
);

# Extension credits that will show up on Special:Version
$wgExtensionCredits['other'][] = array(
	'path' => __FILE__,
	'name' => 'ShowRealUsernames',
	'descriptionmsg' => 'sru-realname-desc',
	'version' => '1.2',
	'author' => array('Paul Lustgarten','John Erling Blad', 
		'[http://www.mediawiki.org/wiki/User:RV1971 RV1971]'),
	'url' => 'https://www.mediawiki.org/wiki/Extension:ShowRealUsernames'
);

$wgAutoloadClasses['ShowRealUsernames'] = 
	__DIR__ . '/ShowRealUsernames.body.php';

$wgShowRealUsernames = new ShowRealUsernames();

$wgHooks['SpecialListusersQueryInfo'][] = array( $wgShowRealUsernames, 
	'onSpecialListusersQueryInfo' );

$wgHooks['SpecialListusersFormatRow'][] = array( $wgShowRealUsernames, 
	'onSpecialListusersFormatRow' );

$wgExtensionMessagesFiles['ShowRealUsernames'] =
	__DIR__ . '/ShowRealUsernames.i18n.php';

?>