Skip to content

Instantly share code, notes, and snippets.

@acebytes
Last active December 5, 2021 00:40
Show Gist options
  • Save acebytes/6c34f5df86a797eed209fbebec2d72d3 to your computer and use it in GitHub Desktop.
Save acebytes/6c34f5df86a797eed209fbebec2d72d3 to your computer and use it in GitHub Desktop.
Skip Formidable Forms User Registration Action
<?php
add_filter( 'frm_skip_form_action', 'form_action_conditions', 10, 2 );
/**
* @param $skip_this_action
* @param $args
* @return bool
*
* Skips user registration actiom if
* email address is already registered
* on the site to avoid validation
* error and allow the form to submit.
*/
function form_action_conditions( $skip_this_action, $args ) {
$user_actions = array(13434, 11454);
if ( 11454 === $args['action']->ID ) {
if ( is_object( $args['entry'] ) ) {
$entry = $args['entry'];
} else {
$entry = FrmEntry::getOne( $args['entry'], true );
}
$email_field = 57;// Replace 104 with your field ID
if ( email_exists( $entry->metas[ $email_field ] ) ) {
$skip_this_action = true;
}
}
return $skip_this_action;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment