'', ), $atts, 'ttdvr_verify_document' ); // Retrieve dynamic settings $custom_label = get_option( 'ttdvr_search_label', 'Enter Document ID / Reference Number / Certificate ID:' ); $bg_color = get_option( 'ttdvr_bg_color', '#088599' ); $btn_color = get_option( 'ttdvr_btn_color', '#0073aa' ); $btn_hover_color = get_option( 'ttdvr_btn_hover_color', '#005177' ); ob_start(); ?>


handle_verification_submission(); ?>
' . esc_html__( 'Security check failed. Please try again.', '24tt-document-verifier' ) . ''; return; } $search_id = sanitize_text_field( wp_unslash( $_POST['ttdvr_verification_id'] ) ); $shortcode_cat = isset( $_POST['ttdvr_shortcode_category'] ) ? sanitize_text_field( wp_unslash( $_POST['ttdvr_shortcode_category'] ) ) : ''; $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '0.0.0.0'; if ( empty( $search_id ) ) { echo '
' . esc_html__( 'Please enter a verification ID.', '24tt-document-verifier' ) . '
'; return; } $args = array( 'post_type' => 'ttdvr_document', 'posts_per_page' => 1, 'meta_query' => array( array( 'key' => '_ttdvr_verification_id', 'value' => $search_id, 'compare' => '=', ), ), ); if ( ! empty( $shortcode_cat ) ) { $args['tax_query'] = array( array( 'taxonomy' => 'ttdvr_doc_category', 'field' => 'slug', 'terms' => $shortcode_cat, ), ); } $documents = new WP_Query( $args ); if ( $documents->have_posts() ) { $documents->the_post(); $post_id = get_the_ID(); $public_cats = get_option( 'ttdvr_public_categories', array() ); $doc_terms = wp_get_post_terms( $post_id, 'ttdvr_doc_category', array( 'fields' => 'ids' ) ); $is_public = true; if ( ! empty( $doc_terms ) && ! is_wp_error( $doc_terms ) ) { $intersect = array_intersect( $doc_terms, $public_cats ); if ( empty( $intersect ) ) { $is_public = false; } } if ( ! $is_public ) { // LOG RESTRICTED ACCESS AS INVALID do_action( 'ttdvr_after_verification_attempt', $search_id, 'invalid', $ip ); echo '
' . esc_html__( 'This document category is restricted and not available for public verification.', '24tt-document-verifier' ) . '
'; wp_reset_postdata(); return; } // --- PRO ANALYTICS LOGGING HOOK (SUCCESS) --- do_action( 'ttdvr_after_verification_attempt', $search_id, 'valid', $ip ); $verification_id = get_post_meta( $post_id, '_ttdvr_verification_id', true ); $recipient_name = get_post_meta( $post_id, '_ttdvr_recipient_name', true ); $document_type = get_post_meta( $post_id, '_ttdvr_document_type', true ); $document_type_other = get_post_meta( $post_id, '_ttdvr_document_type_other', true ); $awarding_body = get_post_meta( $post_id, '_ttdvr_awarding_body', true ); $course_subject = get_post_meta( $post_id, '_ttdvr_course_subject', true ); $grade = get_post_meta( $post_id, '_ttdvr_grade', true ); $performance = get_post_meta( $post_id, '_ttdvr_performance', true ); $issued_date = get_post_meta( $post_id, '_ttdvr_issued_date', true ); $effective_until_date = get_post_meta( $post_id, '_ttdvr_effective_until_date', true ); $document_pdf_url = get_post_meta( $post_id, '_ttdvr_document_pdf_url', true ); $course_details_remarks = get_post_meta( $post_id, '_ttdvr_course_details_remarks', true ); $document_categories = get_the_terms( $post_id, 'ttdvr_doc_category' ); $display_document_type = ( 'Other' === $document_type && ! empty( $document_type_other ) ) ? $document_type_other : $document_type; $show_pdf_setting = get_option( 'ttdvr_show_pdf_link', 'yes' ); ?>


%

' . esc_html__( 'Document not found. Please check the ID and try again.', '24tt-document-verifier' ) . ''; } } }