How to add Custom Blog Options to new blog setup form?
If I understand correctly, it’s not that complicated to achieve what you want, although it cannot be a one-step solution without overriding much of WordPress’ default behavior, mainly because signup (i.e. when your user’s will submit the custom information) and activation (i.e. when the new blog will actually be created) happen separately.
Here is a very rough code that you will need to get started. Hopefully it steers you in the right direction:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | // Add text field on blog signup form add_action('signup_blogform', 'add_extra_field_on_blog_signup'); function add_extra_field_on_blog_signup() { ?> <label>An extra field</label> <input type="text" name="extra_field" value="" /> <?php } // Append the submitted value of our custom input into the meta array that is stored while the user doesn't activate add_filter('add_signup_meta', 'append_extra_field_as_meta'); function append_extra_field_as_meta($meta) { if(isset($_REQUEST['extra_field'])) { $meta['extra_field'] = $_REQUEST['extra_field']; } return $meta; } // When the new site is finally created (user has followed the activation link provided via e-mail), add a row to the options table with the value he submitted during signup add_action('wpmu_new_blog', 'process_extra_field_on_blog_signup', 10, 6); function process_extra_field_on_blog_signup($blog_id, $user_id, $domain, $path, $site_id, $meta) { update_blog_option($blog_id, 'extra_field', $meta['extra_field']); } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.