Change username using costume field
-
I created a registration form as below:
First name :
Last name :
Mobile number:
City :
Email :
Password :Because I didn’t include the username field, the username will be filled in by first name and last name without spaces (cmiiw).
So far everything is working fine.
====== ### ======
On the back end I’ve created a custom field with the following meta key:
1. regno_agent
2. regno_cust
3. regno_partnerAnd this costume field will be filled in by the admin according to their respective roles after the customer has successfully registered/has been approved.
Example :
a. Michael > role > um_agent > regno_agent = a123
b. Samantha > role > customer > regno_cust = c456
c. Dorris > roles > um_partner > regno_partner = p789What I want to ask, how to make this custom field replace the existing username?
I got the reference to change the username as described below
Source: https://www.ads-software.com/support/topic/change-username-after-registration-submit-hook/
However I’m having trouble editing the code to be able to change the username dynamically.
Idea I have are as follows:
1. Change the username using the custom field as in the above example if the field has been updated by admin
2. As long as the costum field is not updated by admin, then leave it as is (username remains first name and last name)
Thank you.
- The topic ‘Change username using costume field’ is closed to new replies.