ExpressionEngine Add-ons

Rating:Insert_Rating_Vote template tag

The Rating:Insert_Rating_Vote tag allows you to enable votes to be submitted on existing reviews for your entries. In other words, when a user writes a rating/review for a channel entry, that review can then be voted up or down. It's a way for your users to indicate which ratings/reviews they find useful and helpful versus unfair or inappropriate. You would normally create vote links in your Rating:Entries loop that in turn would link to a template with this code.

{exp:rating:insert_rating_vote} content {/exp:rating:insert_rating_vote}

Parameters

The following parameters are available for use:

allow_duplicates=

allow_duplicates="no"

This parameter is available to prevent users from submitting duplicate votes for reviews.

duplicate_check_guest_ip=

duplicate_check_guest_ip="no"

This parameter allows you disable IP checking on Guest voting submissions. By default, Rating will check for a matching IP address and a cookie. Setting this parameter to no will set Rating to ONLY look for a cookie with a Guest user. While this isn't a complete solution, it solves the issue where multiple users have a shared IP address.

rating_id=

rating_id="{rating_id}"

This parameter tells the function which rating to count the vote for.

Variables

The following variables are available for use:

message

{message}

This variable will display a success or failure message for the vote.

Conditionals

The following conditionals are available for use:

failure

{if failure}{/if}

This conditional will show its contents if the vote fails for any reason.

success

{if success}{/if}

This conditional will show its contents if the vote is successful.

Examples

The following code example is what your Insert_Rating_Vote template should contain for outputting success or failure messages:

{exp:rating:insert_rating_vote
    rating_id="{segment_3}"
    allow_duplicates="no"
}
    {if failure}
        <h2>Error!</h2>
    {/if}
    {if success}
        <h2>Thank You!</h2>
    {/if}
    <p>{message}</p>
{/exp:rating:insert_rating_vote}

To link to this template, you’ll need to create “up/down” voting links in your Rating:Entries loop, like this (URI vote options are up/yes and down/no). See Rating:Rating_Vote_Stats documentation for more information.