Skip to content

Instantly share code, notes, and snippets.

@alex-authlab
Last active December 4, 2020 08:41
Show Gist options
  • Save alex-authlab/9cfdc3939952adb008da105a816d2d49 to your computer and use it in GitHub Desktop.
Save alex-authlab/9cfdc3939952adb008da105a816d2d49 to your computer and use it in GitHub Desktop.
Fluent Form : Hide form after submission for the same user using IP
add_action('fluentform_before_form_render', 'ff_single_entry_per_user', 10, 1);
function ff_single_entry_per_user( $form )
{
$target_form_id = 1;
$message = "Submission Done! Thanks.";
$hideForm = true;
if($form->id !=$target_form_id ){
return;
}
$exits = wpFluent()->table('fluentform_submissions')
->where('form_id', $target_form_id)
->where('ip', $_SERVER['REMOTE_ADDR'] );
if ($exits) {
echo '<div class="ff-el-group ff-t-container">'.$message.' </div>';
if($hideForm){
exit;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment