Skip Navigation

[Resolved] Change User Role With Cred Form

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.


Can an edit cred form change the user role ?
If i have a user form that creates a user role of "subscriber" then an edit user form that that will change the role to "premium subscriber"

From the article; Part 8 – Building forms for editing user profile (which needs upadate since screen is different in current version)
"3. In the third dropdown, you can determine what kind of users you can update through this form.In Part 6, we decided that our site’s users will be registered with the Subscriber role; thus, we will check Subscriber.If you, as the site admin, would also like to edit your own profile from the front end, check Administrator as well."

From that description it would appear it is only allowing which roles can edit but it does not change role is that correct?

It is possible to do with api but not ui correct?
Is it also possible using api to update a user role from a post edit/create form?

What I need to accomplish is using cred comerce with a woocom and subscrpition plugin (not woocom to pricey) so once a user purchses product it would update the role of the user in accordance with product purchase.



Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

For role editing query, Please check following link:
[ Section: "Vote for new features:"]

Where it says:

With CRED User Forms it is not possible to change the role. Implications:
There is no way to automatically upgrade the subscriptions (e.g. from the Premium to the VIP membership).
You cannot approve user signups directly from the front-end (e.g. to change the Subscriber role to a higher one). You need to do this from the WordPress admin.

Yes - it's possible to change the role using CRED API.

For example:

add_action('cred_save_data', 'my_save_data_action',10,2);
function my_save_data_action($post_id, $form_data)
    if ($form_data['id']=='279')
    $current_user = wp_get_current_user();
    $user_id = $current_user->ID;
    wp_update_user ( array ( $user_id, 'role' => 'inventory_admin' ));

Replace 279 with your CRED form ID.

More info:

Please note that above example is to change role of current logged-in user using CRED API.

You can modify above code as per your needs and add your custom logic. Please note that this is custom programming and that is beyond the scope of our support policy.

If you need custom programming for your project, please feel free to contact our certified partners:


Wonderful that works great thanks 🙂