I would like to set up if subscribers submit a form then the role is changed from subscriber to customer.
For your reference, I am sharing with you the Pionetforms' action hook and filter hook: https://piotnetforms.com/docs/actions-hook-filter-hook/
I have googled and found some code sources, but I have no clue how to work with Pionetforms.
add_action('cred_save_data', 'change_user_role_on_save',10,2);
function change_user_role_on_save($post_id, $form_data)
{
// if a specific form
if ($form_data['id']==573)
{
$user = wp_get_current_user();
if ( in_array( 'subscriber', (array) $user->roles ) ) {
// Remove role
$user->remove_role( 'subscriber' );
// Add role
$user->set_role('customer');
}
}
}
Currently using "members" plugin which is made by memberpress.
I would be grateful if anyone let me know how to solve it. Thank you.
Here is a code:
You can chagne formname1, formname2, formname3, formname4