# GD Star Rating

## filters & actions

This is the list of filters and actions added by the plugin. You can use them as any standard WordPress filters and actions from other plugins or themes. If it's not stated differently, actions don't have additional parameters, and filters have only one parameter. Parameters, if they are existing, are colored red. What needs to be returned is colored blue. If the return is misisng for the filter, than you need to return the variable you got from the filter (input) after modifing it.

### Actions, General

- gdsr_init: executed at the end of plugins init block
- gdsr_admin_menu: executed before adding last menu element
- gdsr_admin_head: executed at the end of plugins admin header block
- gdsr_wp_head: executed at the end of plugins blog header block
- gdsr_init_save_review: executed after saving review values

### Actions, Saving

- gdsr_vote_rating_article: $post_id, $user_id, $vote executed when the rating vote for post/page is saved.
- gdsr_vote_rating_comment: $comment_id, $user_id, $vote executed when the rating vote for comment is saved.
- gdsr_vote_rating_multis: $post_id, $user_id, $set_id, $votes executed when the multis rating vote for post/page is saved.
- gdsr_vote_thumb_article: $post_id, $user_id, $vote executed when the thumb vote for post/page is saved.
- gdsr_vote_thumb_comment: $comment_id, $user_id, $vote executed when the thumb vote for comment is saved.
- gdsr_vote_rating_article_return: $rating_width, $rating, $vote_value executed before rating response is returned.
- gdsr_vote_rating_comment_return: $rating_width, $rating, $vote_value executed before rating response is returned.
- gdsr_vote_rating_multis_return: $json, $summary, $values executed before rating response is returned.

### Filters, Prepare Rendering

- gdsr_query_totals: $query, $widget, $query filter for array of sql elements for the query to get data for total blog rating widget.
- gdsr_query_results: $query, $widget, $query filter for array of sql elements for the query to get data for main widget and rating results.
- gdsr_widget_image_url_prepare: $image, $widget, $row, $image filter for url for the image in the widget or results. returns image url.
- gdsr_widget_data_prepare: filter for array of the results prepared for rating results widget
- gdsr_widget_post_title: modify post title for each of widget results. if you already changed titles using widget settings, this filter will be on changed title, not original. disable widget setting for title if you want to change it using filter.
- gdsr_widget_post_excerpt: modify post excerpt for each of widget results. excerpt will be already prepared and even shortened if you set the length for it in the widget settings.
- gdsr_comments_widget_data_prepare: filter for array of the results prepared for comments rating results widget
- gdsr_comments_widget_comment_content: modify the comment content for each of the widget results. if you already changed it using widget settings, this filter will be on changed content, not original. disable widget setting for content if you want to change it using filter.

### Filters, T2 Rendering, Global

Each rendering function for every template type uses the same filter. Name of the filter is universal, but you need to replace it with actual values for type and element.

- gdsr_t2render_$tpltype_$tplelm: $result, $template, $parameters, $element, $result filter for every type of rendering.
- gdsr_t2parameters_$tpltype: $parameters, $parameters filter for every type of rendering input parameters.

### Filters, T2 Rendering, Results

- gdsr_t2render_wbr_normal: $result, $template, $widget, $element, $result filter for rendering in blog rating widget.
- gdsr_t2render_wcr_header: $result, $template, $widget, $element, $result filter for header rendering in comments rating widget.
- gdsr_t2render_wcr_item: $result, $template, $widget, $row, $element, $result filter for single item rendering in comments rating widget.
- gdsr_t2render_wcr_footer: $result, $template, $widget, $element, $result filter for footer rendering in comments rating widget.
- gdsr_t2render_wsr_header: $result, $template, $widget, $element, $result filter for header rendering in posts rating widget.
- gdsr_t2render_wsr_item: $result, $template, $widget, $row, $element, $result filter for single item rendering in posts rating widget.
- gdsr_t2render_wsr_footer: $result, $template, $widget, $element, $result filter for footer rendering in posts rating widget.
- gdsr_t2render_srr_header: $result, $template, $widget, $element, $result filter for header rendering in posts rating results.
- gdsr_t2render_srr_item: $result, $template, $widget, $row, $element, $result filter for single item rendering in posts rating results.
- gdsr_t2render_srr_footer: $result, $template, $widget, $element, $result filter for footer rendering in posts rating results.

Parameters for this rendering:

- $tpltype: 3 letters short name (type) of the template
- $tplelm: name of the template element
- $result: actual rendered HTML, with all tags still inside, before processing
- $template: full template object
- $parameters: input rendering settings
- $widget: widget settings
- $row: data for the row
- $element: name of the template element