Use email as username, remove input for username.

15 views
Skip to first unread message

Jun Wei Neo

unread,
Sep 21, 2021, 4:09:30 AMSep 21
to Joomla! General Development
I have a registration form that looks like this https://prnt.sc/1sy66y7. But I would like to remove the username and name field in the form so that the user will only register using their email and password.

What I am trying to achieve?
- User will register via their email address and password instead of username and password.
- User will login via their email address and password instead of username and password.

What steps did I take:
I went to the registration.xml file (attached as registration.xml) that is responsible for the form display and
commented out the name and username field.

Problems I faced:
After commenting out the name and username field in the registration.xml file, I would get an error when
registering. Image of the error is in the link below:
https://prnt.sc/1sy54op
https://prnt.sc/1sy5tme

* I have also attached the register function code in registration.txt file. The Register() function is
under RegistrationController that was created by Joomla.
registration.xml
registration.TXT

Benjamin Trenkle

unread,
Sep 27, 2021, 8:12:47 PMSep 27
to Joomla! General Development
Hello,
several things you should consider:
- you need a (user) plugin, to change the form fields in a clean way ($form->removeField)
- Joomla! can't go without an username, so you need the plugin to set this data from the email (use 
onContentBeforeValidateData)
- You need overrides to clean out the not used fields.
Reply all
Reply to author
Forward
0 new messages