Skip Navigation

[Resolved] Auto assign a Role to a user while registering through User Form, based on age.

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.

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Shane 11 months ago.

Assigned support staff: Shane.

Author
Posts
#1825101

I want to auto-assign a Custom Role, based on the user age, when they register to the website through a User Form.

How can I achieve it?

#1825315

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Giulia,

Thank you for getting in touch.

The user role is assigned to the user whenever you are creating the form. In order to achieve your query you will need to make use of custom code to check what is the age value the user added to the form and set their user role based on this.

Unfortunately the custom code required to do this is out of the scope of our support forum, however I can point you to the hook that you will need to use to hook into the form when its submitted.
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

Please let me know if this helps.
Thanks,
Shane