Skip Navigation

[Resolved] Change a user's role upon submission of a form

This thread is resolved. Here is a description of the problem and solution.

Problem:

The question being asked in this thread is that if it is possible to change a user's role upon submission of a post creation form.

Solution:

Yes this is actually possible but you it will need to be done using a CRED hook.

What you need to do is use the hook and then within the hook you can update the user information using the function below.
https://codex.wordpress.org/Function_Reference/wp_update_user

It will take some work but it can be done.

The hook I recommend using is the one below.
https://toolset.com/documentation/user-guides/cred-api/#csd

If this proves too difficult then you are more than welcome to open a support thread.

This support ticket is created 8 years, 1 month 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 4 replies, has 2 voices.

Last updated by daveG-7 8 years, 1 month ago.

Assisted by: Shane.

Author
Posts
#373028

Is it possible to have CRED change a user's role when a create post form is submitted? I would like users to have different abilities if they've filled out different information.

Thanks,

Dave Garlock

#373074

Shane
Supporter

Languages: English (English )

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

Hi Dave,

Thank you for contacting our support forum.

Yes this is actually possible but you it will need to be done using a CRED hook.

What you need to do is use the hook and then within the hook you can update the user information using the function below.
https://codex.wordpress.org/Function_Reference/wp_update_user

It will take some work but it can be done.

The hook I recommend using is the one below.
https://toolset.com/documentation/user-guides/cred-api/#csd

If this proves too difficult then I will be more than happy to help with the setup if you provide some more specific information.

Thanks,
Shane

#373096

Thank you. I may have found a workaround, but if that doesn't work I'll give this a try, and let you know if I need help when / if I do.

#373479

Shane
Supporter

Languages: English (English )

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

Hi Dave,

Sure no problem, i'll be waiting on your response.

If my assistance is not needed then you can mark this ticket as resolved.

Thanks,
Shane

#377629

The workaround works, so I won't be needing further assistance on this topic. Thank you.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.