Plugin Function Reference
Many of these functions are dependent on being within a post/page. This page is only relevant to PHP developers / WordPress themers, for everyone else, automatic embedding and within admin. area customization will allow you to control the appearance of your site.
- myrp_api6_get_rating( $post_id = null, $editors = null, $users = true, $ratingcategory = null, $allow_zeros = null)
float— the weighted rating from 0 to 1Returns the rating as a weighted value from 0 to 1. If the post_id isn't specified, AND you're in the loop, you'll get the ratings for the current post. If any value is null, its value will be loaded from the settings. $editors and $users are boolean flags for whether to include the editor's rating and the user's rating, at least one must be true.
Simple example usage:
$rating = myrp_api6_get_rating() * 5;
echo myrp_api_star_image($rating); // turn the rating in to stars - myrp_api_ratings( $post_id = null )
array— the non-editor, per-category ratings.Returns the rating set for a given post. If the post_id isn't specified, AND you're in the loop, you'll get the ratings for the current post. If the rating is not set, the i18n'd string "Not Rated" will be returned.
- myrp_api_editor_ratings( $post_id = null )
array— the editor, non-average ratings.Returns the editor ratings set for a given post. If the post_id isn't specified, AND you're in the loop, you'll get the ratings for the current post. If the rating is not set, the i18n'd string "Not Rated" will be returned.
- myrp_api_custom_fields( $post_id = null, $exclude = null, $include = null, $translate = true )
array— the custom fields, indexed key=>item.Returns the custom fields for a given post, translated unless otherwise specified.
- myrp_api_ratings_table( $post_id = null, $return = false )
string— the data or nothing.Outputs an identical table to the autoembed functions for user ratings.
- myrp_api_editor_ratings_table( $post_id = null, $return = false )
string— the data or nothing.Outputs an identical table to the autoembed functions for editor's ratings.
- myrp_api_custom_fields_table( $post_id = null, $return = false )
string— the data or nothing.Outputs an identical table to the autoembed functions for custom fields.
- myrp_api_ratings_nontable( $post_id = null, $return = false )
string— the data or nothing.Outputs just the average rating with a label. Identical to the autoembed function for nontable embeds.
- myrp_api_positive_negative( $post_id = null )
array— array(positive, negative) for the countReturns an array of the positive/negative rating values.
- myrp_api_comments_ratings_table( $comment_id = null, $post_id = null, $return = false )
string— the data or nothing.Outputs an identical table to the autoembed functions for comment ratings, usually used in the comments loop.
- myrp_api_comments_ratings_table_vertical( $comment_id = null, $post_id = null, $return = false )
string— the data or nothing.Outputs an identical table to the autoembed functions for comment ratings, in vertical orientation, usually used in the comments loop.
- myrp_api_ratings_form_table( $post_id = null, $return = false )
string— the data or nothing.Outputs the form for ratings, should be included within the comments <form> tag.
- myrp_api_visit_site_url( $post_id = null, $return = false )
string— the data or nothing.Outputs the visit site link according to the parameters specified.
- myrp_api_visit_site_link( $post_id = null, $text = null, $image_set = null, $return = false )
string— the data or nothing.Outputs the visit site link according to the parameters specified.
- myrp_api_post_icon( $post_id = null, $return = false )
string— the data or nothing.Outputs the post icon for the given post according to the parameters specified.
- myrp_api_comparison_table( $category = null, $number = null, $visit_text = "Visit Text", $image_set = null, $custom_fields = null, $rating_categories = null, $return = false )
string— the data or nothing.Outputs the comparison table as given by the parameters or the settings in the admin area.
- myrp_api_vertical_comparison_table($category=null, $number=null, $visit_text="Visit Site", $image_set=null, $custom_fields=null, $rating_categories=null, $return = false, $width=null)
string— the data or nothingOutputs the vertical compparison table given by the parameters or the settings in the admin area.
- myrp_api_google_map( $post_id = null, $width = null, $height = null, $zoom_level = null, $map_type = null, $address_field = null, $return = false )
string— the data or nothing.Outputs the standard Google Map as given by the parameters or the settings in the admin area.
- myrp_api_star_image( $rating, $split_level = 2, $htmlname = null, $class = "star", $disabled = true, $big = false )
string— the data or nothing or the i18n string "Not Rated"Outputs a set of star images with the specified $rating value lit up.
- myrp_api_post_rating( $post_id = null )
int— the rating, returned.Returns the average of all ratings for that post.
- myrp_api_helpfulness_question( $message=null, $comment_id=null, $return=false )
string— the questionOutputs the helpfulness question ("was this helpful") using the $message or the message specified in the autoembed config.
- myrp_api_helpfulness_yes( $comment_id = null )
string— the URLReturns the URL to the "yes" function.
- myrp_api_helpfulness_no( $comment_id = null )
string— the URLReturns the URL to the "no" helpfulness function.
- myrp_api_helpfulness_outcome( $comment_id = null, $return = false )
string— the resultReturns the outcome string as it would have been autoembedded.
- myrp_api_helpfulness_outcome_array( $comment_id = null )
array— the votes, and scoreReturns the outcome data (yes votes, no votes and "score") for further processing.
- myrp_api_get_top_posts($rating_category=null, $post_categories=null, $count=5)
array— the top posts ID and average ratingReturns the top posts in by rating category or in post categories (array). Maximum of count returned.
-
myrp_api_average_comment_field($field_id)
int— the average for a given comment field, across the whole siteReturns the average of a comment field (number fields only) across the whole site. Takes the field ID.
-
myrp_api_average_comment_field_by_post($field_id, $post_id)
int— the average for a given comment field on a single postReturns the average of a comment field (number fields only) across a single post. Takes the field ID and post ID.
-
myrp_api_ratings_by_comment_id($comment_id=null)
array— the ratings on a single postReturns per-category ratings for a given comment.
-
myrp_api_rating_count($post_id=null)
array— the number of ratings on a single postReturns per-category ratings for a given comment.
-
myrp_api_get_raw_average($post_id=null, $scale=5)
int— the average rating of single postReturns average rating for a given post, scaled. Note: averages don't count pass/fail fields
-
myrp_api_get_raw_category_average($post_id=null, $scale=5, $category_id=1)
int— the average rating of single postReturns a numerical average for the post in a given rating category, with each field scaled to $scale.
-
myrp_api_ranking_posts($post_id=null, $mode="average")
string— the ranking of single postReturns the post ranking graphic identical to the embed.
-
myrp_api_comment_field_form_table($post_id=null, $return=false)
string— the form for comment fieldsOutputs the form for comment fields, should be included within the comments <form> tag..
-
myrp_api_big_google_map_arrayposts($array_of_post_ids, $width=null, $height=null, $zoom=null, $mapType=null, $center=null, $return=false)
string— the big mapCreates a Big Google Map with the $array_of_post_ids array rendered on it. Make sure each post has an associated address field.
-
myrp_api_big_google_map_allposts($width=null, $height=null, $zoom=null, $mapType=null, $center=null, $posts_limit=null, $return=false)
string— the big mapCreates a Big Google Map with the top $posts_limit posts (loaded from settings if null) rendered on it. Make sure each post has an associated address field.
-
myrp_api_data_table($table_name, $post_id=null ,$return=false)
string— the data tableRenders the data table if available with name (or slug) $table_name for post ID $post_id (if in the loop, $post_id will be loaded automatically).
MyReviewPlugin also includes a compatibility mode API layer for compatibility with themes developed for other review plugins including WP Review Site and WP Review Engine. Furthermore, every single function exposed by MyReviewPlugin can be used within themes, including hundreds of useful auxillary functions and more non-API layer accessor functions. If you need help, we're available 24/7 to help you implement your solution with MyReviewPlugin.
