Created
October 21, 2021 15:18
-
-
Save nkb-bd/45ffc0104bd4f45828d9fabdf6685a15 to your computer and use it in GitHub Desktop.
Set dynamic user role for WP Fluent Forms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('fluentform_user_registration_feed',function($feed, $entry, $form){ | |
if($form->id != 1){ | |
return; | |
} | |
//get role value | |
$response = json_decode($entry->response,true); | |
$roleInputName = 'input_radio'; | |
$role = $response[$roleInputName]; | |
//set role | |
$feed['processedValues']['userRole'] = $role; | |
return $feed; | |
},10,3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment