*/
var $mNewtalk, $mDatePreference, $mBlockedby, $mHash, $mRights,
$mBlockreason, $mEffectiveGroups, $mImplicitGroups, $mFormerGroups, $mBlockedGlobally,
- $mLocked, $mHideName, $mOptions;
+ $mLocked, $mHideName, $mOptions, $mDisplayName;
/**
* @var WebRequest
$this->mEffectiveGroups = null;
$this->mImplicitGroups = null;
$this->mOptions = null;
+ $this->mDisplayName = null;
if ( $reloadFrom ) {
$this->mLoadedItems = array();
$this->mRealName = $str;
}
+ /**
+ * Return the name of this user we should used to display in the user interface
+ * @return String The user's display name
+ */
+ public function getDisplayName() {
+ global $wgRealNameInInterface;
+ if ( is_null( $this->mDisplayName ) ) {
+ $displayName = null;
+
+ // Allow hooks to set a display name
+ wfRunHooks( 'UserDisplayName', array( $this, &$displayName ) );
+
+ if ( is_null( $displayName ) && $wgRealNameInInterface && $this->getRealName() ) {
+ // If $wgRealNameInInterface is true use the real name as the display name if it's set
+ $displayName = $this->getRealName();
+ }
+
+ if ( is_null( $displayName ) ) {
+ $displayName = $this->getName();
+ }
+
+ $this->mDisplayName = $displayName;
+ }
+ return $this->mDisplayName;
+ }
+
/**
* Get the user's current setting for a given option.
*