Created
October 19, 2015 10:20
-
-
Save danielpowney/a00d4f65a00ca5efccea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $wpdb; | |
$filters_hash = MRP_Multi_Rating_API::get_filters_hash( array() ); // if you want to add any Multi Rating pro specific filters e.g. rating_item_ids | |
$rating_form = MRP_Utils::get_rating_form( $post_id ); | |
$query = 'SELECT SUM(adjusted_score_result) FROM ' . $wpdb->prefix | |
. MRP_Multi_Rating::RATING_RESULT_TBL_NAME . ' rr WHERE rr.post_id = ' . $post_id . | |
' AND rr.rating_form_id = ' . $rating_form_id . ' AND rr.filters_hash = "' . $filters_hash | |
. '" AND rr.rating_item_id IS NULL AND rr.rating_entry_id IS NOT NULL GROUP BY rr.post_id'; | |
echo $wpdb->get_var( $query ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment