-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WPCIVIUX-162 Convert Self Serve Checksum form to a template part
- Loading branch information
1 parent
10262bf
commit 6c81fd4
Showing
2 changed files
with
44 additions
and
29 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
/** | ||
* Default template for the [ux_self_serve_checksum] shortcode. | ||
* | ||
* To customise, copy this file into your theme and make changes as needed. | ||
*/ | ||
|
||
|
||
if ( !$args['form_submitted'] || ( $args['form_submitted'] && !$args['turnstile_passed'] ) ) { | ||
echo $args['form_text']; ?> | ||
<form id="ss-cs-form" method="post" data-turnstilepassed="<?php echo $args['turnstile_passed'] ? 'true' : 'false'; ?>"> | ||
<label for="ss-cs-email">Your email:</label> | ||
<input type="email" id="ss-cs-email" name="ss-cs-email" required> | ||
<input type="hidden" name="ss-cs-title" value="<?php echo get_the_title(); ?>"> | ||
<input type="hidden" name="ss-cs-url" value="<?php echo $args['url']; ?>"> | ||
<?php echo $args['turnstile']; ?> | ||
<button type="submit" name="ss-cs-submit" id="ss-cs-submit">Submit</button> | ||
</form> | ||
<?php | ||
if ( !empty($args['turnstile']) ) { ?> | ||
<script> | ||
let turnstileCompleted = false; | ||
|
||
// This function will be called when Turnstile completes successfully | ||
function onTurnstileComplete(token) { | ||
turnstileCompleted = true; | ||
|
||
let submitButton = document.getElementById('ss-cs-submit'); | ||
submitButton.disabled = false; | ||
} | ||
</script> | ||
<?php } ?> | ||
<?php } ?> |