New Vote Tag
{exp:channel_polls:new_vote}
Parameters
Parameter |
Description |
entry_id |
Entry ID of an Channel Entry. Use this parameter to specify from which entry you want to pull the poll from |
url_title |
Same as entry_id=”” but now it with the entry’s url_title. |
field |
If you have more then one poll field in an entry. You must give the field name or field id. |
field_id |
If you have more then one poll field in an entry. You must give the field name or field id. |
return |
The return template group or full url you wish to return to. |
prefix |
This parameter allows you to change the default variable prefix used. This is especially useful when you are nesting tags to avoid variable collisions. Default is poll. |
check_ip |
If the ExpressionEngine setting `require_ip_for_posting` is set to Yes (the default), Channel Polls will not allow users to submit votes that do not have an IP address. This defaults to "yes", set to "no" to disable. |
Variables
Variable |
Description |
{poll:total_votes} |
Total votes casts already |
{poll:end_date} |
The end date of this poll. For date variable info see: http://expressionengine.com/user_guide/templates/date_variable_formatting.html |
Variable Pairs
{poll:answers} {/poll:answers}
Lists all answers for this poll.
{poll:answers} Variable |
Description |
{poll:form_name} |
The form input name. |
{poll:form_value} |
The form input value. |
{poll:answer} |
The answer. |
{poll:votes} |
Total votes this answer already has. |
Conditionals
Conditional |
Description |
{if poll:already_voted} |
This tag will conditionally display the code inside the tag if the user has already voted in this poll. |
{if poll:not_voted} |
This tag will conditionally display the code inside the tag if the user has not yet voted in this poll. |
{if poll:closed} |
This tag will conditionally display the code inside the tag if the poll has closed. The poll can be closed by reaching it’s specified end date or by closing it manually in the poll options. |
{if poll:no_access} |
This tag will conditionally display the code inside the tag if the user has no access to view the poll. This can happen if the user is part of a member group that cannot vote. |
{if poll:no_poll} |
This tag will conditionally display the code inside the tag if no poll has been found |
Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| {exp:channel:entries channel="default"}
{exp:channel_polls:new_vote entry_id="{entry_id}"}
<ul>
{poll:answers}
<li><input type="radio" name="{poll:form_name}" value="{poll:form_value}"> {poll:answer}</li>
{/poll:answers}
</ul>
{if poll:closed}<h4>POLL CLOSED</h4>{/if}
{if poll:no_access}<h4>YOU HAVE NO ACCESS</h4>{/if}
{if poll:already_voted}<h4>ALREADY VOTED</h4>{/if}
{if poll:not_voted}<h4>NOT VOTED YET</h4>{/if}
<input name="submit" value="VOTE" type="submit">
{/exp:channel_polls:new_vote}
{/exp:channel:entries} |
Support
Having problems setting up and/or using Channel Polls? Support is offered from 10am to 4pm EST weekdays. Send us an email at help@eeharbor.com and we will respond as quickly as we can.