Source for file function.displayname.php
Documentation is available at function.displayname.php
/**** smarty_function_displayName
* This is a smarty function which will allow different values to be
* output to identify users (real_name, user, user_id) as opposed todo
* only allowing the 'login' to be output.
* hash=fooHash is a short cut to specifying each parameter by hand
* usage: {displayname user= user_id= real_name= link_title=}
if( !empty( $pParams['hash'] ) ) {
// if the hash only has a user_id, we need to look up the user
if( @BitBase::verifyId( $hash['user_id'] ) && empty( $hash['user'] ) && empty( $hash['email'] ) && empty( $hash['login'] )) {
$lookupHash['user_id'] = $hash['user_id'];
// We were probably just passed the 'login' due to legacy code which has yet to be converted
if( strpos( '@', $pParams['hash'] ) ) {
$lookupHash['email'] = $hash;
$lookupHash['user_id'] = $hash;
$lookupHash['login'] = $hash;
} elseif( !empty( $pParams['user_id'] ) ) {
$lookupHash['user_id'] = $pParams['user_id'];
} elseif( !empty( $pParams['email'] ) ) {
$lookupHash['email'] = $pParams['email'];
} elseif( !empty( $pParams['login'] ) ) {
$lookupHash['login'] = $pParams['login'];
} elseif( !empty( $pParams['user'] ) ) {
$lookupHash['login'] = $pParams['user'];
} elseif( empty( $pParams ) ) {
$hash = $gBitUser->mInfo;
if( !empty( $lookupHash ) ) {
$hash = $gBitUser->getUserInfo( $lookupHash );
// Now we're really in trouble. We don't even have a user_id to work with
$displayName = "Unknown";
|