string alias,
 string name,
 string lastName,
 string login

The method returns a user name, depending on alias access permission and parameters. If permitted, the alias will be returned - if not, and the name and the last name are available, then they will be returned. Otherwise, only site user login will be returned. Static method.

Method parameters

ParameterDescriptionAvailable from version
alias Blog user alias.
name Site user name.
lastName Site user last name.
login Site user login.
secondName Optional parameter. Value by default - "".

Returned value

User name is returned.

Examples of use

//display the name of the current user for blogs
$dbUser = CUser::GetByID($USER->GetID());
$arUser = $dbUser->Fetch();
$BlogUser = CBlogUser::GetByID($arUser["ID"], BLOG_BY_USER_ID); 
$AuthorName = CBlogUser::GetUserName($BlogUser["ALIAS"], $arUser["NAME"], $arUser["LAST_NAME"], $arUser["LOGIN"]);
echo $AuthorName;

© «Bitrix24», 2001-2023