I am trying to customize a signup process for our MultiSite Network I need to be able to assign levels based on a choice at signup.
My thought is to add a field (hidden or otherwise) that holds the chosen level during signup, and assign that to the registering user somehow, (via meta?) and have that passed along when creating site. I assume there should be a way as their username and email is passed to the database right?
Then when they activate their new site via activation link email, I could run a custom function, (there must be a hook for after site creation) that would grab that meta value I passed along use it in a custom function post activation.
Does this make sense? Thank you for any input!
I am trying to customize a signup process for our MultiSite Network I need to be able to assign levels based on a choice at signup.
My thought is to add a field (hidden or otherwise) that holds the chosen level during signup, and assign that to the registering user somehow, (via meta?) and have that passed along when creating site. I assume there should be a way as their username and email is passed to the database right?
Then when they activate their new site via activation link email, I could run a custom function, (there must be a hook for after site creation) that would grab that meta value I passed along use it in a custom function post activation.
Does this make sense? Thank you for any input!
Share Improve this question edited Jan 3, 2014 at 20:37 thatryan asked Jan 3, 2014 at 16:51 thatryanthatryan 4331 gold badge5 silver badges14 bronze badges 4- Code behind the paywall is considered not in scope here. Please try to make your question more generic - what is happening (in WordPress core terms) and how you are trying to modify it. – Rarst Commented Jan 3, 2014 at 18:58
- I apologize for that, I edited the question to remove those parts. I am trying to add custom meta on the signup page that can be passed along after activation, and then used in a function after site activation. – thatryan Commented Jan 3, 2014 at 20:38
- what are you using for your sign up form? custom or default? – user44672 Commented Jan 3, 2014 at 21:56
- Just the default form – thatryan Commented Jan 3, 2014 at 23:30
1 Answer
Reset to default 0I know it's a very old question, but I had the same issue and this was never resolved so I thought I'd post a solution. I found the answer in a different topic here on WPSE.
You only have to use the filter add_signup_meta
.
function sb_add_signup_meta($meta) {
// hardcoded value
$meta['mykey'] = 'My Value';
// $_POST value from register form
if ( isset( $_POST[ 'value' ] ) && ! empty( $_POST[ 'value' ] ) ) {
$meta[ 'meta_key' ] = $_POST[ 'value' ];
}
return $meta;
}
add_filter('add_signup_meta', 'sb_add_signup_meta');