Last active
December 4, 2020 08:41
-
-
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
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_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