Skip to content

Instantly share code, notes, and snippets.

@reachkamrul
Created June 9, 2020 11:55
Show Gist options
  • Save reachkamrul/c541fb9d40ff81ee7cd6ae0fd5d9fc44 to your computer and use it in GitHub Desktop.
Save reachkamrul/c541fb9d40ff81ee7cd6ae0fd5d9fc44 to your computer and use it in GitHub Desktop.
add_action('fluentform_before_insert_submission', function ( $insertData, $data, $formId ) {
if($formId->id != 52) { // You can pass your form id here
return;
}
// Email based check
$isExist = wpFluent()->table('users')
->where('user_email', $data['email'])
->first();
if($isExist) {
wp_send_json(['errors' => [
'restricted' => [
'Sorry! there are already an account registered with your email.'
]
]], 422);
}
}, 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment