get_var( $wpdb->prepare( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = '_ttdvr_verification_id' AND meta_value = %s LIMIT 1", $cert_id ) ); if ( $post_id && get_post_status( $post_id ) === 'publish' ) { // Check the "Kill Switch" to see if the category is restricted $public_cats = get_option( 'ttdvr_public_categories', array() ); $doc_terms = wp_get_post_terms( $post_id, 'ttdvr_doc_category', array( 'fields' => 'ids' ) ); $is_restricted = false; // If the document has categories, check if ANY of them are allowed if ( ! empty( $doc_terms ) ) { $intersect = array_intersect( $doc_terms, $public_cats ); if ( empty( $intersect ) ) { $is_restricted = true; // No overlap found, it is restricted! } } if ( $is_restricted ) { $result_status = 'restricted'; } else { // Document is Valid and Public! Grab the data to display. $result_status = 'valid'; $document = array( 'id' => $cert_id, 'recipient' => get_post_meta( $post_id, '_ttdvr_recipient_name', true ), 'type' => get_post_meta( $post_id, '_ttdvr_document_type', true ), 'course' => get_post_meta( $post_id, '_ttdvr_course_subject', true ), 'date' => get_post_meta( $post_id, '_ttdvr_issued_date', true ), 'pdf' => get_post_meta( $post_id, '_ttdvr_document_pdf_url', true ), 'categories' => wp_get_post_terms( $post_id, 'ttdvr_doc_category', array( 'fields' => 'names' ) ) ); } } else { $result_status = 'invalid'; } } ?>

ID:
Recipient Name:
Document Type:
Course / Subject:
Issued Date: