ap_is_user_answered( integer $question_id, integer $user_id )
Description #
Check if user answered on a question.
Parameters #
- $question_idinteger (Required) Question ID.
- $user_idinteger (Required) User ID.
Source #
File: includes/functions.php
function ap_is_user_answered( $question_id, $user_id ) { global $wpdb; $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->posts where post_parent = %d AND ( post_author = %d AND post_type = 'answer')", $question_id, $user_id ) ); // phpcs:ignore WordPress.DB return $count > 0 ? true : false; }
Expand full source code Collapse full source code View on GitHub: includes/functions.php:276
Add your comment