Hello! I’m making a like button for a project i’m doing and had it working fine, but then decided that it might be better if users weren’t forced to have an account in order to interact and use the feature.
When I built it before, I was able to keep a list of those who liked it, and prevent them from liking again. This was obviously the most secure method.
Does anyone have a good solution for creating a like button that guest users can use? It wouldn’t have to be as secure (i.e., if they find a way to like multiple times it’s not a big problem).
Thanks for any help you can offer!
Hey there @matt29,
Welcome to the Bubble community!
Maybe you can do this with IP addresses? But then that’ll result in issues with people in the same household not being able to like again.
I’m aware of that issue, but that could be worth it still. Could you advise on how I would do it w/ IP address?
Every bubble user has a bubble user ID even if they’re not logged in. So you can still commit the current user’s ID to a table, users not logged in only get served with a new ID if they clear down their browser cache/cookies, NOT if they just revisit the site.
Yeah, just install the ipify plugin, then store a list of ips as texts then make a check when upvoting if the get IP address doesn’t contain list of ips then it allows it else no.
You could also use cookie. You set a cookie on the unsigned in user when they up or down vote, and the cookie contains the ID of the voted item. This way, even if the ip address of the user changes, your app will still know he has already voted for the item (based on the fact that before any vote, you search for the tracking contents and you check that the item ID is not part of the cookie contents)