@@ -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,13 @@ 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;
+
+// Hide the username in course chat
+//$_configuration['hide_username_in_course_chat'] = 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
@@ -121,7 +121,13 @@ $(document).on('ready', function () {
' </button>';
html += ' </li>' +
+ {% if not 'hide_username_in_course_chat'|api_get_configuration_value %}
' <li><small>' + user.username + '</small></li>' +
+ {% else %}
+ ' <li> </li>' +
+ {% endif %}
' </ul>' +
' </div>' +
'</li>';
@@ -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.')';