$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>multisite - How can I add custom meta on signup page and pass along to be used after blog activation?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

multisite - How can I add custom meta on signup page and pass along to be used after blog activation?

matteradmin9PV0评论

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
Add a comment  | 

1 Answer 1

Reset to default 0

I 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');
Post a comment

comment list (0)

  1. No comments so far