Problem:
The issue here is that the user wanted to change their user's role when they submit a post form.
Solution:
This can be done by using out cred_before_save_data hook along with the add_role() wordpress function.
Take a look at this link here.
https://usersinsights.com/wordpress-custom-role/
In a practical example it would look something like this.
add_action('cred_before_save_data_22', 'before_save_data_for_form_with_id_22',10,1); function before_save_data_for_form_with_id_22($form_data) { if ( is_user_logged_in() ) { if ($form_data['id']=='22') { $current_user = wp_get_current_user(); $current_user->set_role('subscriber'); } } else { } }
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 2 replies, has 2 voices.
Last updated by 5 years, 2 months ago.
Assisted by: Shane.