Add $bAllowDefaultPicture parameter to UserRights::GetContactPictureAbsUrl() to return null instead of the default picture

This commit is contained in:
Molkobain
2020-08-13 14:55:13 +02:00
parent f90a5b77ad
commit f2725c5a5c
2 changed files with 27 additions and 12 deletions

View File

@@ -224,11 +224,18 @@ class NavigationMenu extends UIBlock
*/
protected function ComputeUserData()
{
// Use a picture set in the preferences is there is none in the user's contact
$sPictureUrl = UserRights::GetContactPictureAbsUrl('', false);
if(empty($sPictureUrl))
{
$sPictureUrl = utils::GetAbsoluteUrlAppRoot().'images/user-pictures/' . appUserPreferences::GetPref('user_picture_placeholder', 'user-profile-default-256px.png');
}
//Todo : what do we show if no contact is linked to the user ?
$aData = [
'sOrganization' => UserRights::GetContactOrganizationFriendlyname(),
'sFirstname' => UserRights::GetContactFirstname(),
'sPictureUrl' => UserRights::GetContactPictureAbsUrl(),
'sPictureUrl' => $sPictureUrl,
'sWelcomeMessage' => Dict::Format('UI:Layout:NavigationMenu:UserInfo:WelcomeMessage:Text', UserRights::GetContactFirstname())
];