diff --git a/bl-kernel/admin/views/edit-user.php b/bl-kernel/admin/views/edit-user.php
index 2eca8b66..675cdcd1 100644
--- a/bl-kernel/admin/views/edit-user.php
+++ b/bl-kernel/admin/views/edit-user.php
@@ -101,6 +101,15 @@ echo Bootstrap::formInputHidden(array(
'tip' => ''
));
+ echo Bootstrap::formSelect(array(
+ 'name' => 'displayNameMode',
+ 'label' => $L->g('Display Name'),
+ 'options' => array('nickname' => $L->g('Nickname'), 'fullname' => $L->g('Full Name'), 'firstname' => $L->g('First Name')),
+ 'selected' => $user->displayNameMode(),
+ 'class' => '',
+ 'tip' => $L->g('if-not-present-fallback-on-username')
+ ));
+
echo Bootstrap::formTitle(array('title' => $L->g('More Infos')));
echo Bootstrap::formInputText(array(
diff --git a/bl-kernel/user.class.php b/bl-kernel/user.class.php
index 244920e3..545f7a34 100644
--- a/bl-kernel/user.class.php
+++ b/bl-kernel/user.class.php
@@ -50,6 +50,36 @@ class User
return $this->getValue('username');
}
+ public function displayName()
+ {
+ $mode = $this->getValue('displayNameMode');
+ $name = $this->firstName();
+ $lastName = $this->lastName();
+ $nickname = $this->nickname();
+ $username = $this->username();
+ switch ($mode) {
+ case 'fullname':
+ if ($name && $lastName) {
+ return $name." ".$lastName;
+ } elseif ($name) {
+ return $name;
+ } else {
+ return $username;
+ }
+ case 'firstname':
+ return $name ?? $username;
+ case '':
+ case 'nickname':
+ default:
+ return $nickname ?? $username;
+ }
+ }
+
+ public function displayNameMode()
+ {
+ return $this->getValue('displayNameMode');
+ }
+
public function pronouns()
{
return $this->getValue('pronouns');
diff --git a/bl-kernel/users.class.php b/bl-kernel/users.class.php
index 9dd834b8..092769e1 100644
--- a/bl-kernel/users.class.php
+++ b/bl-kernel/users.class.php
@@ -6,6 +6,7 @@ class Users extends dbJSON {
'firstName'=>'',
'lastName'=>'',
'nickname'=>'',
+ 'displayNameMode'=>'nickname',
'pronouns'=>'',
'description'=>'',
'homepage'=>'',
diff --git a/bl-languages/en.json b/bl-languages/en.json
index a93bcfa2..93d3c3d2 100644
--- a/bl-languages/en.json
+++ b/bl-languages/en.json
@@ -130,10 +130,13 @@
"add-a-new-category": "Add a new category",
"name": "Name",
"username": "Username",
+ "display-name": "Display Name",
"first-name": "First name",
"last-name": "Last name",
+ "full-name": "Full name",
"pronouns": "Pronouns",
"to-schedule-the-content-select-the-date-and-time": "To schedule the content select the date and time, the status has to be set to \"Published\".",
+ "if-not-present-fallback-on-username":"If the value isn't present, it'll fallback on the username",
"email": "Email",
"role": "Role",
"registered": "Registered",
diff --git a/bl-languages/fr_FR.json b/bl-languages/fr_FR.json
index 39d3c365..65e5f309 100644
--- a/bl-languages/fr_FR.json
+++ b/bl-languages/fr_FR.json
@@ -130,10 +130,13 @@
"add-a-new-category": "Ajouter une nouvelle catégorie",
"name": "Nom",
"username": "Nom d’utilisateur",
+ "display-name": "Nom affiché",
"first-name": "Prénom",
"last-name": "Nom",
+ "full-name": "Prénom et Nom",
"pronouns": "Pronoms",
"to-schedule-the-content-select-the-date-and-time": "Pour planifier votre contenu, sélectionnez la date et l’heure, le statut doit être défini sur \"Publié\".",
+ "if-not-present-fallback-on-username":"Si la valeur n'est pas présente, alors cela affichera le nom d'utilisateur",
"email": "E-mail",
"role": "Rôle",
"registered": "Inscrit",
diff --git a/bl-themes/popeye/php/page.php b/bl-themes/popeye/php/page.php
index 9728e6dd..f3ab2487 100644
--- a/bl-themes/popeye/php/page.php
+++ b/bl-themes/popeye/php/page.php
@@ -14,7 +14,7 @@
readingTime() . ' ' . $L->get('minutes') . ' ' . $L->g('read') ?>
- user('nickname') ?>
+ user('displayName') ?>