Skip Navigation

[Resolved] User Form

This support ticket is created 4 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 4 replies, has 2 voices.

Last updated by jonE-2 4 years, 9 months ago.

Assisted by: Beda.

Author
Posts
#1600021
user form.png

Tell us what you are trying to do?

I want the autogenerated user name on the User Form - Profile Form to be the user's first and last name. Is that the default setting, and if not, how do I change it?

I want to delete the Nickname field. How do I do so?

What is the link to your site?

hidden link

Thank you.

#1600505

You can't delete the Nickname Field when using the Drag and Drop edit mode of the forms, you could only autogenerate it.
You could hide it, for example inside a Conditional Block (that never triggers to visible), or wrapping in HTML blocks that hide the content (class="hidden")

In Expert Mode, you could delete the source code.

Now, on an Edit Form, the User Name is already set, and can't be changed by WordPress Default Behaviour, so it is also not possible to autogenerate it.

On a Form that creates users, though, it makes sense and is possible.
If autogenerated, it would then generate the Username and Nickname in a bit unexpected way:
Using the email
So if the user completed the email field with "email@domain.com", then the Username and Nickname, if autogenerated in the Form, will use "email"

To manipulate that value further, you'd have to apply some custom code to the cred_save_data() hook:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

However, it'll be tricky to update the Username, because WordPress itself does not allow this.
The method to use https://developer.wordpress.org/reference/functions/wp_update_user/ would be the logical solution but it won't update the username, see https://wordpress.stackexchange.com/questions/103504/how-to-programatically-change-username-user-login
You'd have to resort to direct database interaction as shown on the Stackoverflow ticket

It is eventually easier to populate the (hidden) username field with some custom JS on the fly before submitting the form, by grabbing the data from the user first and last name inputs.

Are you comfortable writing and maintaining either PHP or JS?

#1603181

Thank you. I took over the site for Jon and don't have experience writing and maintaining PHP or JS.

#1603687

In this case, I suggest to consult with a Contractor from https://toolset.com/contractors/, because in Toolset Support we could only example, but not fully craft (or maintain) such custom code.

Additionally, there will be the hurdle of the interaction with the database as mentioned if you want to update the username.

#1604155

My issue is resolved now. Thank you!