vmichnowicz / vwm_polls

Free ExpressionEngine Poll Module and Fieldtype
Apache License 2.0
16 stars 8 forks source link

Ability to "un-vote", for testing #33

Closed GaryReckard closed 10 years ago

GaryReckard commented 10 years ago

I am using your Polls module, and find it a bit tedious to test out my polls. It would be nice if a user or admin had the option of undoing their vote. I have tried manually removing my vote from the database table, but then found out I had to also remove a cookie, otherwise your already_voted() method would return true.

So, could you add an "un-vote" feature? Perhaps on the front-end, or in the field settings, that would remove a vote and unset the cookie? Thanks!

vmichnowicz commented 10 years ago

Give this branch of VWM Polls a go and see how it works for you. Just add something like this in your template:

<a href="{unvote_url}">Unvote</a>
GaryReckard commented 10 years ago

Awesome! It mostly works, except the return URL is only grabbing the last segment of the URL. So, if I have the poll at http://www.domain.com/polls/view/paper-or-plastic/results/, and click the unvote link, it returns me to http://www.domain.com/results/...

vmichnowicz commented 10 years ago

I was unable to reproduce that issue, but I made a small change to the code. Try that download again and see if that fixes the issue.

GaryReckard commented 10 years ago

That change fixed the issue for me!