Registering a value / adding it to a user's score just once

HI, if I have code that is worth say, a value of 10 - I want a user to enter that code and have this value added to the users “score”, but I only want to allow them to add this value once (hence the code). How would I do it? I’m really stuck but I’m sure I’ve seen this in a tutorial.

Any help massively appreciated.

Can a user add more than one code? If not then a simple yes/no field (default = no) on the user data type should do the trick. When they add a code, set the field to yes and only allow adding a code when the field is not yes.

If a user can add multiple codes then have a code field on the user data type that is a list of texts (or a list of codes if you have a thing in your db called code). When a user adds a code, add the code to that field for that user and only allow a user to add a code if their list of codes does not already contain that code.

Wow, Louisadekoya, thank you soooo much!!! Totally never thought of any of these suggestions. You’ve really helped me out here. Thank you, thank you, thank you. I’ll give a try now.

1 Like