Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //add_action('gform_post_submission_7', 'my_update_user_role');
- add_action('gform_after_submission_7', 'my_update_user_role', 10, 2);
- function my_update_user_role($entry) {
- //$user_id = get_current_user_id();
- //$user_id = (int) $_GET['user'];
- //$user_id = wp_get_current_user();
- // trying this as suggested by Chris Hajer
- global $current_user;
- get_currentuserinfo();
- $user_id = $current_user->ID;
- echo $user_id;
- if(!$user_id)
- return;
- $user = new WP_User($user_id);
- //$user->set_role('editor'); // update "editor" to the name of the role you'd like to update the user too
- $user->remove_role( 'subscriber' );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement