Soma Posted May 10, 2012 Share Posted May 10, 2012 Some time ago there was a question if it's possible to change the "name" field on the users to "Username". Here's how I answered with a module example. May it be helpful to someone. <?php class UserNameLabel extends WireData implements Module{ public static function getModuleInfo() { return array( 'title' => __('UserNameLabel', __FILE__), // Module Title 'version' => 100, 'summary' => __('Overwrite User Name Label', __FILE__), // Module Summary 'autoload' => true ); } public function init() { // only add hook if on user pages if(strpos($_SERVER['REQUEST_URI'],'/users/') !== FALSE ) $this->addHookAfter("Inputfield::render", $this, "changeLabel"); } public function changeLabel($event){ $inputfield = $event->object; // only if the right inputfield if(!$inputfield instanceof InputfieldName ) return; // overwrite the label return $event->object = $inputfield->label = __("Username"); } } UserNameLabel.module.zip 2 Link to comment Share on other sites More sharing options...
gebeer Posted September 12, 2015 Share Posted September 12, 2015 Thank you Soma for this module. This is quite some time ago. For 2.6.x versions of PW, is there a way to change the label without having to use a module? I can't find this field anywhere, even with "$config->advanced = true;" Link to comment Share on other sites More sharing options...
LostKobrakai Posted September 12, 2015 Share Posted September 12, 2015 You can change the label for the name field in each template's settings individually. Link to comment Share on other sites More sharing options...
gebeer Posted September 12, 2015 Share Posted September 12, 2015 In the user template (or clones of it) there is no field "name". I have set $config->advanced = true; Link to comment Share on other sites More sharing options...
Mike Rockett Posted September 12, 2015 Share Posted September 12, 2015 You won't find it in the field list - check under "Advanced", like every other template. 2 Link to comment Share on other sites More sharing options...
gebeer Posted September 12, 2015 Share Posted September 12, 2015 Thank you, found it in Advanced tab Exactly what I was looking for. So no need for Soma's module anymore. But still, I find it confusing that the name field is not editable from the Basics tab. Link to comment Share on other sites More sharing options...
LostKobrakai Posted September 12, 2015 Share Posted September 12, 2015 The name field is technically not a field, that's why it's not there. 3 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now