[ad_1]
Let’s say users could sign up for a free account on a website and the default user account comes with a custom field labeled “User Credits”.
Then, a user can run around a convention space with their phone and when the user scans a QR code on a sign, they have 10 Credits added to their account or maybe it subtracts 50 Credits and adds 1 Gold.
What kind of functionality do I need to add to set up something like this?
[ad_2]
It’s fairly straightforward. Setup an action hook on say wp_head and in that hooked function:
1. Check if the current page is a bonus credits page.
2. Check the user meta for whether they received a bonus for this page (to prevent multiple bonuses)
3. If not, update the ‘credits’ user meta field with the current bonus, AND
4. Update the user meta to record that they got the bonus for this page.
ACF can create custom fields for users so that you can see the result.