Forum Academy Marketplace Showcase Pricing Features

[Poll tool] Prevent users to answer twice

Hi,
I’m building a tool that enables my readers to answer a 1-question poll at the end of my newsletters. When a user clicks on an answer, they’re redirected to a thank you page with the poll id and their answer in the url so that the answer is added to my database.
I wonder if it’s possible to prevent them from voting twice by any chance? There must be a trick to do that (but I have no idea how ^^)…
Thanks in advance for your help!

Hi there, @dlepunski… the concept in this post might work for you, so it’s probably worth checking out.

Best…
Mike

Hi @mikeloc, that’s exactly what I was looking for indeed.

My poll system is a little bit different from the one described in this topic, although the solution should work as well.
What is different is that I make people vote by clicking on a link in a newsletter that redirects them to a “thank you for your vote” page where the poll id and the vote itself are parameters in the URL (parameters that I catch to fill in the answers’ database).

So I have created the list of users in the Poll’s Data type, but I don’t know how to add the Current User to this list in the workflow when the page is loaded. The reason is that the thank you page URL passes the poll’s id and the user’s vote, so at the moment my workflow consists in adding a new answer in the database with the vote and poll in the Answers Data type, not in the Polls Data type.

So I need to add a step to change the Poll’s users list, but the “Make change to thing” doesn’t allow me to (see screenshot). I’m not even sure the privacy rules allow to change a Poll to add a user list to it, as the user who visits this thank you page is not the Poll’s creator. So I’m a bit lost here and don’t know what to do.

I could easily be missing something here, but you have the id of the poll, so you should be able to access it pretty easily. I would have to play around with it, but in the Thing to change, you might be able to select the result of step 1’s poll. I believe you could also do the search that you are showing, but add the :first item operator to the end of it, and add a constraint to the search that gets the poll’s id from the URL.

About the privacy rules, you might have to let users who are not the poll’s creator find polls in searches and also allow them to update the users list, but all of this is just kind of shooting in the dark without being able to see all of the details.

Ok, I know it’s not easy to explain things without showing them (but I actually don’t know how to share you my editor in view-only mode!)
Anyhow I have a few comments on your last message:

  • I can select the result of step 1 but the logical order of the workflow should be to add the Current user to the Poll’s user list first, so that an answer is registered in step 2 only when this list doesn’t contain Current user already, right?
  • I’m not very familiar with :first item but I’m not sure it’s the right solution, considering that someone can vote on an “old” poll, not necessarily the first or last created (it’s sent through a newsletter, so it can be retrieved by user at any time). But if this operator can be combinated with a constraint where poll id must match the parameter in the URL, then this could be a solution indeed (in which case the operator would mean "match the first item in the Poll’s data type that has this id, right?)

My bad… I got caught up on one thing in the screenshots and just went from there. You need a condition on the first step of the workflow that creates the response only when the user does not exist in the poll’s users list. Then, the second step would make changes to the poll and add the user to the users list only when the result of step 1 is not empty.

Yes, your description of how to use the :first item operator is correct.

Oh, and the way to share your editor in view-only mode is to go to the Settings >> General tab, change the Application rights dropdown to Everyone can view, and copy/paste a link to any page in the editor.

Just a quick example that might help as a reference…

Thanks for everything @mikeloc, it works like a charm :slight_smile:

1 Like

Hi @mikeloc,
Unfortunately it doesn’t work at all, actually ^^
I thought I had done exactly what you had told me, though. Could you please have a look at the thank you page here? A-votre-avis | Bubble Editor
You’ll see in the data tab for the Answers type (“Réponses”) that you can actually vote twice…
Thanks in advance!

I think it could be related to the privacy rule on the Sondage data type. Try checking the box for the Votants field under everyone else and see if that helps.

If it was me, I would probably remove the privacy rules altogether on the Sondage and User data types and do a test. If it works, then you know for a fact that privacy rules are the culprit, and you can go from there.

1 Like

Checking the box for the Votants fields under everyone else did work indeed!
You’re amazing @mikeloc, feel free to let me know how I can buy you a cup of coffee :slight_smile:
Thanks again!

1 Like