Skip to content

Commit 02c72a1

Browse files
committed
Change defaulr UserSwitcher user label from name to {name} ({email}) and add support for formatting string tags.
1 parent 2fdfdf8 commit 02c72a1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

TracyDebugger.module.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static function getModuleInfo() {
2727
'summary' => __('Tracy debugger from Nette with many PW specific custom tools.', __FILE__),
2828
'author' => 'Adrian Jones',
2929
'href' => 'https://processwire.com/talk/forum/58-tracy-debugger/',
30-
'version' => '4.26.78',
30+
'version' => '4.26.79',
3131
'autoload' => 100000, // in PW 3.0.114+ higher numbers are loaded first - we want Tracy first
3232
'singular' => true,
3333
'requires' => 'ProcessWire>=2.7.2, PHP>=5.4.4',
@@ -284,7 +284,7 @@ static public function getDefaultData() {
284284
"userSwitcherSelector" => '',
285285
"userSwitcherRestricted" => null,
286286
"userSwitcherIncluded" => null,
287-
"userSwitcherUserLabel" => 'name',
287+
"userSwitcherUserLabel" => '{name} ({email})',
288288
"todoIgnoreDirs" => 'git, svn, images, img, errors, sass-cache, node_modules',
289289
"todoScanAssets" => null,
290290
"todoScanModules" => null,
@@ -4491,8 +4491,8 @@ public function getModuleConfigInputfields(array $data) {
44914491
$f = $this->wire('modules')->get("InputfieldText");
44924492
$f->attr('name', 'userSwitcherUserLabel');
44934493
$f->label = __('User label field', __FILE__);
4494-
$f->description = __('Use this to determine which user field will be used to identify users in the selection interace.', __FILE__);
4495-
$f->notes = __('Default: `name`', __FILE__);
4494+
$f->description = __('Use this to determine which user field(s) will be used to identify users in the selection interace.', __FILE__);
4495+
$f->notes = __('Default: `{name} ({email})`', __FILE__);
44964496
if($data['userSwitcherUserLabel']) $f->attr('value', $data['userSwitcherUserLabel']);
44974497
$fieldset->add($f);
44984498

panels/UserSwitcherPanel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function getPanel() {
110110

111111
foreach($selectableUsers->sort('name') as $u) {
112112
if($u->hasStatus('unpublished')) continue;
113-
if(count($u->roles)>1) $out .= '<option id="user_'.$u->id.'" value="'.$u->name.'" style="padding: 2px; ' . ($this->wire('user')->name === $u->name ? 'background:'.TracyDebugger::COLOR_WARN.'; color: #FFFFFF;" selected="selected"' : '"') . '>'.$u->get(\TracyDebugger::getDataValue('userSwitcherUserLabel').'|name').'</option>';
113+
if(count($u->roles)>1) $out .= '<option id="user_'.$u->id.'" value="'.$u->name.'" style="padding: 2px; ' . ($this->wire('user')->name === $u->name ? 'background:'.TracyDebugger::COLOR_WARN.'; color: #FFFFFF;" selected="selected"' : '"') . '>'.str_replace('()', '', wirePopulateStringTags(\TracyDebugger::getDataValue('userSwitcherUserLabel'), $u)).'</option>';
114114
}
115115
$out .= '
116116
</select>

0 commit comments

Comments
 (0)