Passing referral code through when signing up user

Let's say a user signs up (with email or OAuth). They enter a referral code on the sign up form. Then upon creation of the user account, I need to store the referral code in the database on the user object. How do I go about doing this?
Was this page helpful?