I have assigned a field in the user database of my Joomla site to hold a value for a users experience (userxp). When a new user registers, they are assigned a default userxp value of 0. I'm going to be developing a system where a user completes quests and earns XP. Once a user gains a certain amount of XP, I want Joomla to automatically assign them to a new user group. I've set up custom user groups (Level 1, Level 2, Level 3, etc).
What I'd like to do is get the users XP value, and then assign them to the appropriate user group. For instance, if the XP value is 0, do nothing - the user group is level 1 by default. But if the userxp value is 10, remove the user from user group Level 1 and add them to user group Level 2. If the userxp value is 100, remove the user from user group Level 2 and assign them to user group Level 3. You get the gist, a standard leveling system like any RPG ever.
I've done some research that suggests editing the helper.php file and making use of the addUserToGroup and removeUserFromGroup methods. I am a total greenhorn when it comes to PHP so I'm wondering if anyone could help me out here.