Code to add different roles based on submission?

I am aware of the “add role” snippet, but could anyone tell me if there’s a way to assign a different role based on what the input on the form was? As in, if it matches a codeword, user receives x role. if it matches another codeword, user receives y role.

I’m re-making a site my wife has nostalgia for, and it used to let people redeem online pets by inputting specific ‘codes’ you got from the original trading cards. My plan is to give roles to reveal parts of the collection on the site as she uncovers them.

I’m assuming you’re using the User Registration add-on? I almost suggested created multiple Update feeds and then using conditional logic to dictate which feed/role should be processed… but a form can only have a single GFUR update feed. :confused:

With that said, I have some ancient code that would let you create those conditionals as part of the snippet configuration. Provided as is but my company does provide snippet support for Advanced and Pro customers.