![]() |
Creating username from email with Tank Auth - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Creating username from email with Tank Auth (/showthread.php?tid=52862) |
Creating username from email with Tank Auth - El Forum - 06-29-2012 [eluser]Unknown[/eluser] I use Codeigniter framework + Tank_Auth registiration library. They work great but I just need to change register form a bit. I want to generate username from email address instead of getting it from registeration form. I added a simple function to libraries/Tank_auth.php file. Here is my username generator function: Code: function _create_username_from_email($email) Please let me know where I need to run my function and write it to database. 1) I will also need to remove username field from register form. So I need how I can pass form validation for username field in my controller. 2) I will be really happy if any of you can help me about these problem. Thanks Creating username from email with Tank Auth - El Forum - 06-30-2012 [eluser]Go-Trex[/eluser] Hi, Set the following settings in config/auth.php Code: $config['use_username'] = FALSE; When a visitor registers at your site they do not need to fill in a username and when they log in they can only log in with a valid email address and password combination. When you want to save the email address as a username overwrite the following function in libraries/Tank_auth.php Code: function create_user($username, $email, $password, $email_activation) Creating username from email with Tank Auth - El Forum - 07-01-2012 [eluser]Unknown[/eluser] Hi, This has solved my problem, thanks a lot Go-Trex. |