[rt-users] Change username format of autocomplete list

Thomas Sibley trs at bestpractical.com
Mon Oct 24 09:52:49 EDT 2011


On 10/22/2011 02:32 PM, Peter Reuterås wrote:
> Is there a standard way to add a new username format? If I understand
> correctly the format is the one the user select on the Setting ->
> Options page and the default specified in $UsernameFormat. The current
> options are "concise" and "verbose". How to add a "superverbose" with
> name, email and work phone? Couldn't find any suggestions in the wiki.

share/html/Elements/ShowUser is what looks at the system setting or user 
preference and dispatches to the right component for display 
(ShowUserVerbose vs. ShowUserConcise out of the box).

You'll need to add a share/html/Elements/ShowUserSuperverbose (note 
casing since the preference is lower-cased an then the first letter 
upper-cased) and then either Set($UsernameFormat, 'superverbose'); 
globally and/or write some Perl in your config to add superverbose to 
the user preference options.  Something like this might do the trick:

push @{$RT::Config::META{UsernameFormat}->{WidgetArguments}{Values}}, 
'superverbose';
$RT::Config::META{UsernameFormat}->{WidgetArguments}{ValuesLabel}{superverbose} 
= 'Name, email address, and phone number';

That's untested, so give it a shot.

Thomas



More information about the rt-users mailing list