Created
October 2, 2023 00:20
-
-
Save wpeasy/ff93a2dc927199ce2202d8594a9c8476 to your computer and use it in GitHub Desktop.
WS Form fields to Thank You
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 get_wsf_submission_by_url_hash(){ | |
static $submission; | |
if(!isset($_GET['hash'])) return 'No Hash URL parameter'; | |
if(!$submission){ $submission = wsf_submit_get_by_hash($_GET['hash']); } | |
return $submission; | |
} | |
function fetch_wsf_submission_field($field_id) { | |
$submission = get_wsf_submission_by_url_hash(); | |
if(!($submission instanceof WS_Form_Submit)){ | |
return $submission; | |
} | |
$ret = (wsf_submit_get_value($submission, $field_id)); | |
if(isset($ret)){ | |
return $ret; | |
}else{ | |
return 'Field not set'; | |
} | |
} | |
function fetch_wsf_submission_message() | |
{ | |
$submission = get_wsf_submission_by_url_hash(); | |
if(!($submission instanceof WS_Form_Submit)){ | |
return $submission; | |
} | |
$message = 'Message Not defined'; | |
$type = 'info'; | |
BugFu::log($submission); | |
foreach($submission->actions as $action){ | |
if($action['id'] === 'message'){ | |
$message = $action['meta']['action_message_message']; | |
$type = $action['meta']['action_message_type']; | |
break; | |
} | |
} | |
return "<span class='message-type-{$type}'>$message</span>"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment