Add hide_username_with_complete_name conf setting - refs BT#14769

Hide the username when showing the complete name for a user
pull/2688/head
Angel Fernando Quiroz Campos 7 years ago
parent 50a817feb9
commit afba2a6f73
  1. 2
      main/inc/lib/api.lib.php
  2. 4
      main/install/configuration.dist.php
  3. 4
      src/Chamilo/UserBundle/Entity/User.php

@ -1461,7 +1461,7 @@ function _api_format_user($user, $add_password = false, $loadAvatars = true)
$result['complete_name'] = api_get_person_name($result['firstname'], $result['lastname']);
$result['complete_name_with_username'] = $result['complete_name'];
if (!empty($user['username'])) {
if (!empty($user['username']) && !api_get_configuration_value('hide_username_with_complete_name')) {
$result['complete_name_with_username'] = $result['complete_name'].' ('.$user['username'].')';
}

@ -958,6 +958,10 @@ VALUES (2, 13, 'session_courses_read_only_mode', 'Lock Course In Session', 1, 1,
]
];*/
// Hide the username when showing the complete name for a user.
// Example: using api_get_user_info()['complete_name_with_username'] or $user->getCompleteNameWithUsername()
//$_configuration['hide_username_with_complete_name'] = false;
// ------ Custom DB changes (keep this at the end)
// Add user activation by confirmation email
// This option prevents the new user to login in the platform if your account is not confirmed via email

@ -793,6 +793,10 @@ class User implements UserInterface //implements ParticipantInterface, ThemeUser
*/
public function getCompleteNameWithUsername()
{
if (api_get_configuration_value('hide_username_with_complete_name')) {
return $this->getCompleteName();
}
return api_get_person_name($this->firstname, $this->lastname).' ('.$this->username.')';
}

Loading…
Cancel
Save