How do I start the verification process for a customized thank you page in Wordpress?
You can easily add verification to any page by using the [tot-reputation-status] WordPress shortcode. Token of Trust automatically creates a Page that does exactly this (used as part of our Verification Gates feature). If you’d like to check it out - navigate to /verification-required on your site to take a peek. It will require that you sign in if you’re not already and in fact we recommend that you give it a try with a new user and incognito window.
Here’s more information on How to add shortcodes to a page if this is new to you. And if you’d like the verification process to start automatically you should use this version to auto-launch the process when the user is not verified: [tot-reputation-status auto-launch-when-not-verified="true" ]
This shortcode generates customizable blocks for different verification states. Here are the code snippets that show the filters we use and that you can replace in the usual way:
return apply_filters('tot_verification_gates_request_signin_block', "<p>You will need to sign-in before you can proceed.</p>");
return apply_filters('tot_verification_gates_error_block', "<p>There was a problem verifying you - please check back later.</p>");
return apply_filters('tot_verification_gates_approved_block', "<p>Thank you - you've been verified!</p>");
return apply_filters('tot_verification_gates_pending_block', "<p>Thank you - your verification has been submitted! Watch your email inbox. We will get that approved as quickly as we're able to!</p>");
return apply_filters('tot_verification_gates_rejected_block', "<p>You've not passed verification. Please contact us for more information!</p>");
Lastly here’s the ‘not verified’ block which is the state before users land on this page:
return apply_filters("tot_verification_gates_not_verified_block", '<div class="tot-wc-order-validation">'
. '<a data-tot-verification-required="true" href="#tot_get_verified">'
. __('Verification', $tot_plugin_text_domain)
. '</a> '
. __(' is required before you can proceed.', 'token-of-trust')
. '</div>');
We don’t recommend changing the ‘not verified’ block since that could make you less resilient to plugin upgrades but it is possible for those that really need it. The main thing is to just be sure to keep this bit from the code above since it launches the verification snippet.
<a data-tot-verification-required="true" href="#tot_get_verified">
This allows the plugin to find and launch the modal automatically as well as create the onClick action to launch that process using the button.
I want to show the user different things on a page depending upon their current verification state.
Use the tot-reputation-status shortcode. This code is different from the accountConnector bc it doesn’t take you away from the site. It also doesn’t require signin the first time it is used (though it will require code after that). It will only work on a page where the current user is signed in so should be on a profile page or the like. Looking at the code I can already see it’s not internationalized… but the blocks for each region (approved, rejected, pending, etc) can be customized so you can internationalize. Here’s a breadcrumb to find the code (which is in shortcode-tot-reputation-status.php):
function tot_reputation_status_shortcode($attrs, $content = null)
Examples of how we do this can be found in this code: tot-get-verified.js.
The full list of different blocks are:
tot_verification_gates_not_verified_block
tot_verification_gates_rejected_block
tot_verification_gates_pending_block
tot_verification_gates_approved_block
tot_verification_gates_error_block
tot_verification_gates_request_signin_block
If the user has not gone through the verification process the last block (tot_verification_gates_not_verified_block) should be rendered.