hf_form_success hook
-
I’ve added the following code to the bottom of html-forms.php but it fails to make the change in role desired. Am I putting this code in the right place? The form itself is located on the request page: https://memremix.com/request/.
//change subscriber to contributor on successful form submission
add_action( ‘hf_form_success’, function( $submission, $form ) {
if ( ! is_page( ‘request’ ) ) return;
$user_id = get_current_user_id();
$user = get_userdata($user_id);
$user_roles = $user->roles;
if (in_array(“subscriber”, $user_roles)){
$user->set_role(“contributor”);
}
}, 10, 2);Thank you for your assistance.
The topic ‘hf_form_success hook’ is closed to new replies.