Lets say you have name and email field or it can be just email as well.
setup your confirmation mail like this or something similar
make the mail_field_id same with your mail field id. idea is to create a new page and forward users to that page and add the shortcode there.
https://yourwebsite.com/newsletter/?verify-my-mail={{mail_field_id}}&tempid=0301010101202501170117
add this php code to your functions.php or your code snippet.
// [verify_email] Shortcode // Example verification URL: /verify-mail/?verify-my-mail={user_email} add_shortcode('verify_email', 'verify_user_email_via_shortcode'); function verify_user_email_via_shortcode() { $output = ''; // Check if the 'verify-my-mail' GET parameter is set if ( isset($_GET['verify-my-mail']) ) { // Sanitize the email input $email = sanitize_email( $_GET['verify-my-mail'] ); // Validate the email format if ( ! is_email( $email ) ) { $output .= '<div class="email-verification-error">' . esc_html__( 'Invalid email address provided for verification.', 'your-text-domain' ) . '</div>'; return $output; } global $wpdb; // Define the table name with the WordPress prefix $table_name = $wpdb->prefix . 'bricks_form_submissions'; // Prepare the query to find any submissions containing this email in form_data JSON $query = $wpdb->prepare( "SELECT id, browser FROM $table_name WHERE JSON_SEARCH(form_data, 'all', %s) IS NOT NULL", $email ); $submissions = $wpdb->get_results( $query ); if ( ! empty( $submissions ) ) { $total_submissions = count( $submissions ); if ( $total_submissions > 1 ) { // Multiple records found; assume email is already verified $output .= '<div class="email-verification-notice">' . esc_html__( 'This email has already been verified.', 'your-text-domain' ) . '</div>'; } elseif ( $total_submissions === 1 ) { $submission = $submissions[0]; if ( strtolower( $submission->browser ) === 'verified' ) { // Single record already verified $output .= '<div class="email-verification-notice">' . esc_html__( 'This email has already been verified.', 'your-text-domain' ) . '</div>'; } else { // Single record not verified; proceed to verify $update_query = $wpdb->prepare( "UPDATE $table_name SET browser = %s WHERE id = %d", 'Verified', $submission->id ); $updated = $wpdb->query( $update_query ); if ( $updated !== false ) { // Successfully updated $output .= '<div class="email-verification-success">' . esc_html__( 'Your email has been successfully verified.', 'your-text-domain' ) . '</div>'; } else { // Update failed $output .= '<div class="email-verification-error">' . esc_html__( 'An error occurred while verifying your email. Please try again later.', 'your-text-domain' ) . '</div>'; } } } else { // No submissions found, though this block might be redundant $output .= '<div class="email-verification-error">' . esc_html__( 'No record found for this email address. It may have already been verified or is invalid.', 'your-text-domain' ) . '</div>'; } } else { // No matching submission found for this email $output .= '<div class="email-verification-error">' . esc_html__( 'No record found for this email address. It may have already been verified or is invalid.', 'your-text-domain' ) . '</div>'; } } else { // If no parameter provided, show a generic message or nothing $output .= '<div class="email-verification-notice">' . esc_html__( 'No verification email provided.', 'your-text-domain' ) . '</div>'; } return $output; } // showing Verification status green on the table list function custom_admin_footer_script() { ?> <script type="text/javascript"> document.addEventListener('DOMContentLoaded', function() { // 1. Change the header text from "Browser" to "Verification" var browserHeader = document.querySelector('th#browser'); if (browserHeader) { browserHeader.textContent = 'Verification'; } // 2. Modify the styling of the table cells based on their content var theList = document.getElementById('the-list'); if (theList) { // Select all <td> elements with class 'browser' within '#the-list' var browserTds = theList.querySelectorAll('td.browser'); browserTds.forEach(function(td) { // Trim the text content to avoid issues with leading/trailing whitespace var content = td.textContent.trim(); // Check if the text content includes 'Verified' if (content.includes('Verified')) { td.style.color = 'green'; td.style.fontWeight = 'bold'; } else { td.style.color = 'white'; td.style.fontWeight = 'normal'; // Reset font weight if not verified } }); } }); </script> <?php } add_action('admin_footer', 'custom_admin_footer_script');
enable your save submissions setting and add action to your form as well.
This code adds multiple things;
1 – verify_email shortcode. add this shortcode to your for example /newsletter/ mail page so people can verify their mail whe nthey click the link from mail
2 – verify function when someone clicks the link from confirmation mail that has /newsletter/?verify-my-mail={user_email} this changes to verified status for that mail submission
3 – verification green label on the table
there are 2 cons to this method
method is too simple opt-in method works one way only after opt-in there is no way to opt-out. ıdidnt implemented this because didnt find a reason we only need opt-ted in mail list thats it.
another negative is I am actualy changing browsre column to varification column in surface. I was going to add new column but decided not to because long term after bricks updates method might break but keeping the implementation native to the core makes this method long term safe.
thats it other than this 2 cons script works fine I tested it.