Created
October 10, 2024 17:09
-
-
Save joemaller/3db6278652a08237bc6a053dd3853ef6 to your computer and use it in GitHub Desktop.
Function to validate Gravity Forms gf_token save tokens for accessing in-progress 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
<?php | |
function validateGF_Token($token) | |
{ | |
global $wpdb; | |
$gf_drafts_table = $wpdb->prefix . 'gf_draft_submissions'; | |
$table_check = $wpdb->get_var("SHOW TABLES LIKE '{$gf_drafts_table}'"); | |
if ($table_check !== $gf_drafts_table) { | |
return false; | |
} | |
$query = "SELECT * FROM $gf_drafts_table WHERE uuid = %s"; | |
$prepared_query = $wpdb->prepare($query, $token); | |
$results = $wpdb->get_results($prepared_query); | |
return count($results) > 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment