That way your users are able to choose whatever user name they like.
You only need the second line if you want to change the max. length of a name
If you want to give your users the ability to "fix" their names, add the following line to the config: $Configuration['Garden']['Profile']['EditUsernames'] = true;
I would announce that possibility of changing the name and make it available for a restricted time.
YES! Thank you, goodness! I was finding such solution whole day. It makes a trick for me in theme hook. I slightly modified it to fallback to username if display name was not set:
Well, yeah, activity titles are not affected by it as you noted. Seems like a problem with Vanilla+Smarty user modifier (applications/dashboard/views/activity/helper_functions.php, line 30, function Gdn_Format::to), but as expected behavior users mentioned in activity should convert to userAnchor result, but no luck today.
Answers
Forget everything else and add this two lines to your /conf/config.php:
$Configuration['Garden']['User']['ValidationRegex'] = '\\d\\w-_ äöüß'; $Configuration['Garden']['User']['ValidationLength'] = '{3,20}';That way your users are able to choose whatever user name they like.
You only need the second line if you want to change the max. length of a name
If you want to give your users the ability to "fix" their names, add the following line to the config:
$Configuration['Garden']['Profile']['EditUsernames'] = true;I would announce that possibility of changing the name and make it available for a restricted time.
Thanks @R_J !
YES! Thank you, goodness! I was finding such solution whole day. It makes a trick for me in theme hook. I slightly modified it to fallback to username if display name was not set:
<?php if (!defined('APPLICATION')) exit; class ForumThemeHooks implements Gdn_IPlugin { public function setup() { return true; } } if (!function_exists('userAnchor')) { function userAnchor($User, $CssClass = null, $Options = NULL) { static $NameUnique = null; if ($NameUnique === null) { $NameUnique = c('Garden.Registration.NameUnique'); } if (is_array($CssClass)) { $Options = $CssClass; $CssClass = null; } elseif (is_string($Options)) { $Options = array('Px' => $Options); } $Px = val('Px', $Options, ''); $DisplayName = GetUserDisplayName($User); $Text = val('Text', $Options, htmlspecialchars($DisplayName)); $Attributes = array( 'class' => $CssClass, 'rel' => val('Rel', $Options) ); if (isset($Options['title'])) { $Attributes['title'] = $Options['title']; } $UserUrl = userUrl($User, $Px); return '<a href="'.htmlspecialchars(url($UserUrl)).'"'.attribute($Attributes).'>'.$Text.'</a>'; } function GetUserDisplayName($User) { $DisplayName = $User->Name; $SQL = Gdn::sql(); $SQL ->Select('u.Value') ->From('UserMeta u') ->Where('u.UserID', $User->UserID) ->Where('u.Name', "Profile.Fullname"); $UserMeta = $SQL->Get()->FirstRow(); if (isset($UserMeta->Value) and !empty($UserMeta->Value)) { $DisplayName = $UserMeta->Value; } return $DisplayName; } }Well, yeah, activity titles are not affected by it as you noted. Seems like a problem with Vanilla+Smarty
usermodifier (applications/dashboard/views/activity/helper_functions.php, line 30, functionGdn_Format::to), but as expected behavior users mentioned in activity should convert touserAnchorresult, but no luck today.