Gatemi Product Questions Developer Reference

Storage

There are no tables. Everything is WordPress comments and comment meta.

What Name
Question comment type gmqa_question, on the product
Answer comment type gmqa_answer, comment_parent = the question
Asker asked to be emailed comment meta _gmqa_notify on the question
Asker has been emailed (the claim) comment meta _gmqa_notified on the question
Answer came from a buyer comment meta _gmqa_order (the order ID) on the answer
Full edition: buyer addresses asked comment meta _gmqa_asked, one row per address, on the question
Full edition: vote count / voters _gmqa_helpful and _gmqa_voter (one row per voter: u:{user id} or c:{hash of the cookie}) on the answer
Full edition: import fingerprint _gmqa_source on an imported question
Full edition: where the next buyer scan starts _gmqa_scan_page (an order page number) on the question, while a scan is still under way
Settings option gmqa_settings (both editions, same shape)
Product tab gmqa_questions (#tab-gmqa_questions), priority 35

Both editions use the same comment types, meta keys, settings and field names.

The shared FAQ filters

The same in Gatemi Product Questions and Gatemi Product Info, both editions of each.

Filter How Product Questions uses it
gatemi_faq_schema_owner — apply_filters( 'gatemi_faq_schema_owner', '' ) Asks it in wp_footer at priority 20. A non-empty answer (Product Info answers gatemi-product-info) means another plugin prints the block, so Product Questions prints nothing.
gatemi_faq_schema_items — apply_filters( 'gatemi_faq_schema_items', $items, $product ) Adds its answered questions at priority 20, skipping questions already in the list, only where its tab is shown. When nobody owns the block, it applies the filter itself, starting from an empty list, and prints the block.

Items are array( 'question' => string, 'answer' => string ), plain text. Malformed items are dropped. The JSON is encoded with JSON_HEX_TAG | JSON_HEX_AMP, so a </script> in a question cannot end the element.

Free edition

The free edition applies no filters of its own besides the shared pair.

Full edition: filters

Filter Arguments Default What it tunes
gmqa_enabled_for $enabled, $product after the category list Whether one product takes questions — the tab, the form, the FAQ contribution and buyer runs all ask it.
gmqa_display_limit 50 — How many answered questions one product page lists.
gmqa_max_length 2000 — The longest question or answer accepted, in characters (at least 20).
gmqa_answer_email $mail, $question, $answer — The "your question was answered" email. Return false to send nothing — the question stays claimed.
gmqa_buyer_email $mail, $question, $order — The email asking a past buyer. Return false to send nothing.
gmqa_buyers $order_ids, $question — The orders whose buyers are asked, before the per-question limit. You can only remove orders: an order that did not buy the product is still refused.
gmqa_settings $settings — The merged settings.
gmqa_modules $modules — The module list.
gmqa_license_api_url, gmqa_update_cache_ttl — — The licence endpoint and update cache lifetime.

$mail is an array with to, subject and message, and optionally headers (a string or an array) and attachments (an array). All five are passed to wp_mail(), so a filter can add a Reply-To, a From, a content type or a file.

// Take no questions on products that are out of stock.
add_filter( 'gmqa_enabled_for', function ( $enabled, $product ) {
	return $enabled && $product && $product->is_in_stock();
}, 10, 2 );
// Sign the answer email with the shop's name.
add_filter( 'gmqa_answer_email', function ( $mail ) {
	if ( is_array( $mail ) ) {
		$mail['message'] .= "nnThe team at " . get_bloginfo( 'name' );
	}
	return $mail;
} );

Full edition: actions and cron

Hook Arguments What
gmqa_booted (action) $container The plugin has finished booting.
gmqa_ask_buyers (cron) the question ID One single event per question, a minute after approval or Ask past buyers.
gmqa_license_check (cron) — The licence check.

Form fields and query args

Ask form: gmqa_question, gmqa_name, gmqa_email, gmqa_notify, gmqa_product, gmqa_ask, nonce field gmqa_nonce (action gmqa_ask), and the hidden trap field gmqa_website. The result comes back in the query arg gmqa (asked, invalid, long, duplicate, flood, login, expired).

Full edition: gmqa_vote, gmqa_answer_text, gmqa_sort (helpful or newest), the buyer link's gmqa_answer, gmqa_order and gmqa_token, and the cookie gmqa_visitor.

Privacy tools

Both editions register a personal data exporter and eraser with the id gatemi-product-questions, beside WordPress' own comment exporter.

CSS classes

Shared by both editions: .gmqa-questions, .gmqa-list, .gmqa-question, .gmqa-question-text, .gmqa-label, .gmqa-answer, .gmqa-answer-text, .gmqa-answer-meta, .gmqa-buyer, .gmqa-notice, .gmqa-empty, .gmqa-ask, .gmqa-ask-title, .gmqa-ask-form, .gmqa-field, .gmqa-hp, .gmqa-note, .gmqa-submit, .gmqa-login.

Full edition: .gmqa-sort, .gmqa-vote (.gmqa-vote--done after voting), .gmqa-vote-button, .gmqa-answer-form.

Shopping Cart
Scroll to Top