View Full Version : Plugin to capitalize username on registration
malmazan
02-27-2012, 05:00 PM
Hi all:
I'm after a plugin that capitalizes the username on registration, as I require name and last name.
This is what I have:
$username = ucwords(strtolower($this->fetch_field('username')));
$username_raw = $username;
vB_Template::preRegister('register',array('usernam e_raw' => $username_raw));
assingned to userdata_presave
but it does not work.
I would be very grateful for some help
What hook location are you using (or where did you put that code)?
malmazan
02-28-2012, 07:25 AM
What hook location are you using (or where did you put that code)?
userdata_presave
I used the first two lines succesfully with v3.6, though it stopped working with v3.7
Sarteck
02-28-2012, 08:43 AM
Why not (on the same hook):
$this->set('username', ucwords(strtolower($this->fetch_field('username'))));
Not tested, but that line should (every time the userdata_presave is called) set the Capitalized Username to the datamanager, should it not?
malmazan
02-29-2012, 10:26 AM
Why not (on the same hook):
$this->set('username', ucwords(strtolower($this->fetch_field('username'))));
Not tested, but that line should (every time the userdata_presave is called) set the Capitalized Username to the datamanager, should it not?
Thanks for the help, though it does not seem to have any effect (does not give an error either).
malmazan
03-02-2012, 08:01 AM
Thanks for the help, though it does not seem to have any effect (does not give an error either).
Actually, I was wrong, it DOES work. Somehow the resulting user name shown on the screen was not capitalized, but the one that ended up on the database was.
That'll save me from having to edit a php file on every update. Thanks a bunch, Sarteck
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.