public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/admin/functions.php
/**
 * Update a question to track how many quizzes are using this question.
 *
 * @since 1.0.0
 *
 * @param integer $questionID The ID of the question to update with the count.
 *
 * @return integer The number of quizzes using a question.
 */
Update a question to track how many quizzes are using this question.

@param integer $questionID The ID of the question to update with the count.

@return integer The number of quizzes using a question.
Update a question to track how many quizzes are using this question . @param integer $questionID The ID of the question to update with the count . @return integer The number of quizzes using a question .
function WPCW_questions_updateUsageCount( $questionID ) {
	if ( ! intval( $questionID ) ) {
		return;
	}
	global $wpdb, $wpcwdb;
	$wpdb->show_errors();
	$usageCountForQuestion = $wpdb->get_var( $wpdb->prepare( "
		SELECT COUNT(*)
		 FROM $wpcwdb->quiz_qs_mapping
		WHERE question_id = %d
	", $questionID ) );
	$wpdb->query( $wpdb->prepare( "
		UPDATE $wpcwdb->quiz_qs
		SET question_usage_count = %d
		WHERE question_id = %d
	", $usageCountForQuestion, $questionID ) );
	return $usageCountForQuestion;
}
function WPCW_questions_updateUsageCount ( $ questionID ) { if ( ! intval ( $ questionID ) ) { return ; } global $ wpdb , $ wpcwdb ; $ wpdb -> show_errors ( ) ; $ usageCountForQuestion = $ wpdb -> get_var ( $ wpdb -> prepare ( " 
		SELECT COUNT(*)
		 FROM  $ wpcwdb -> quiz_qs_mapping 
		WHERE question_id = %d
	 " , $ questionID ) ) ; $ wpdb -> query ( $ wpdb -> prepare ( " 
		UPDATE  $ wpcwdb -> quiz_qs 
		SET question_usage_count = %d
		WHERE question_id = %d
	 " , $ usageCountForQuestion , $ questionID ) ) ; return $ usageCountForQuestion ; }
Update a question to track how many quizzes are using this question.
Update a question to track how many quizzes are using this question .
// Update tag popularity // Update the count in the tag field