public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/admin/functions.php
/**
 * Update the popularity stats for a tag.
 *
 * @since 1.0.0
 *
 * @param integer $tagID The ID of the tag to update the popularity for.
 */
Update the popularity stats for a tag.

@param integer $tagID The ID of the tag to update the popularity for.
Update the popularity stats for a tag . @param integer $tagID The ID of the tag to update the popularity for .
function WPCW_questions_tags_updatePopularity( $tagID ) {
	if ( ! intval( $tagID ) ) {
		return;
	}
	global $wpdb, $wpcwdb;
	$wpdb->show_errors();
	$usageCountForTag = $wpdb->get_var( $wpdb->prepare( "
		SELECT COUNT(*)
		  FROM $wpcwdb->question_tag_mapping
		WHERE tag_id = %d
	", $tagID ) );
	$wpdb->query( $wpdb->prepare( "
		UPDATE $wpcwdb->question_tags
		SET question_tag_usage = %d
		WHERE question_tag_id = %d
	", $usageCountForTag, $tagID ) );
}
function WPCW_questions_tags_updatePopularity ( $ tagID ) { if ( ! intval ( $ tagID ) ) { return ; } global $ wpdb , $ wpcwdb ; $ wpdb -> show_errors ( ) ; $ usageCountForTag = $ wpdb -> get_var ( $ wpdb -> prepare ( " 
		SELECT COUNT(*)
		  FROM  $ wpcwdb -> question_tag_mapping 
		WHERE tag_id = %d
	 " , $ tagID ) ) ; $ wpdb -> query ( $ wpdb -> prepare ( " 
		UPDATE  $ wpcwdb -> question_tags 
		SET question_tag_usage = %d
		WHERE question_tag_id = %d
	 " , $ usageCountForTag , $ tagID ) ) ; }
Update the popularity stats for a tag.
Update the popularity stats for a tag .
// Update tag popularity // Update the count in the tag field