multi site/pro site registration signup form

I am trying to replicate the signup workflow that you use with edublogs.com. I like letting the user be able to create their username, password and blog URL/info on one screen. Using the wp-signup.php form even with pro sites seems very clunky. It is possible that I am just missing one of the needed plugins to accomplish this but I'm not sure.

Any ideas would be appreciated. If there was an option to allow the user to select a paid version during registration that would be even better but even getting it to function similar to edublogs.com would get me headed in the right direction.

Thanks!
Brian

  • Timothy Bowers

    Hey there.

    Essentially it's the default WP signup process with a few extras like not having to confirm email. It's then put into a custom template.

    The easiest way to achieve what you want without custom code is to use a plugin like Gravity Forms or Formidable Pro.

    Gravity Forms:

    http://gravityforms.com

    Formidable Pro

    http://formidablepro.com

    As for the purchase on signup in Pro Sites, not possible right now but it's something for the future. :slight_smile:

    Take care.

  • bseibenick

    Thanks, I had actually read both of those already. I was hoping that you had a nice plugin all ready to go :wink:

    I had already tried the registration form as part of the gravity forms but the weird thing with that is that it creates the site but it also adds the new user as a subscriber to the site's main WP site which I'd prefer to not let it do.

    I might try out Formidable Pro before going the custom route.

    Thanks!
    Brian

  • Timothy Bowers

    Hey there.

    We don't currently have a plugin, it's a custom template we used within the theme. Sorry.

    Usually when you register you get to a site you get the default role of Subscriber, in a multisite you also get a kinda pseudo subscriber role to every site within the network.

    Is there a specific reason you don't want them having a role in the main site?

    Is it not something you could restrict through the use of a role editor plugin?

    Role editing plugins:

    http://wordpress.org/plugins/user-role-editor/

    Or:

    http://wordpress.org/plugins/advanced-access-manager/

    Take care.

  • bseibenick

    I think I figured out where I went wrong. Since I was testing the signup for at first (using Gravity Forms) I didn't enable to create the additional site so the user had to get created somewhere. When I enabled 'create site' within network options of the Gravity Forms User Registration add-on then it created things as I expected.

    I think the issue was mainly me looking at it too long and missed the obvious checkbox.

    The only issue I seem to have now is not being able to create sites with the Multi Domain plugin when users register through Gravity Forms. From reading others talk on the forum it looks like some custom coding needs to happen. Do you by chance know where I need to look for this?

    Thanks!
    Brian

  • bseibenick

    I think the post there deals more with how to display the multi domain dropdown. I was trying to test by putting the full URL into a text box but I think the issue is more with the validation and/or some hook that the multi domain plugin adds upon site creation.

    In the Gravity Forms Registraion code (userregistration.php) I found the function that creates the site starting at line 1999

    public static function create_new_multisite($user_id, $config, $lead, $password) {
            global $current_site;
    
            $form = RGFormsModel::get_form_meta($lead['form_id']);
            $ms_options = rgars($config, 'meta/multisite_options');
            $is_update_feed = rgars($config, 'meta/feed_type') == 'update';
            $user = new WP_User($user_id);
    
            $password_field = rgars($config, 'meta/password');
            $set_password = $password_field && rgar($lead, $password_field);
            $password = $password ? $password : rgar($lead, $password_field);
    
            // @review, verify what this is doing and notate here
            if(!$set_password)
                remove_filter('update_welcome_email', 'bp_core_filter_blog_welcome_email');
    
            // is create site option enabled?
            if(!$ms_options['create_site'])
                return;
    
            $site_data = self::get_site_data($lead, $form, $config, $is_update_feed);
            if(!$site_data)
                return;
    
            // create the new site!
            $blog_id = wpmu_create_blog($site_data['domain'], $site_data['path'], $site_data['title'], $user_id , array( 'public' => 1 ), $current_site->id);

    I think line 2024 might be the one that needs something modified to pull in whatever the multi domain plugin is doing:
    $blog_id = wpmu_create_blog($site_data['domain'], $site_data['path'], $site_data['title'], $user_id , array( 'public' => 1 ), $current_site->id);

    Any thoughts?

    Thanks,
    Brian

  • bseibenick

    FYI, I was able to get this working by modifying userregistration.php.

    For my first test I changed line 2024 from:

    $blog_id = wpmu_create_blog($site_data['domain'], $site_data['path'], $site_data['title'], $user_id , array( 'public' => 1 ), $current_site->id);

    to:

    $blog_id = wpmu_create_blog('static.domain2.com', $site_data['path'], $site_data['title'], $user_id , array( 'public' => 1 ), $current_site->id);

    Doing that forced the new signup site to use the 'static.domain2.com' URL and the site setup successfully.

    The next step I did was to add the following option to the Gravity Forms Registration setup screen:

    $multisite_options['site_suffix'])

    This variable will hold the selected domain 'suffix' (domain2.com in my example) when setting data is stored to sql.

    Once the user's suffix was saves I modified this section of the get_site_data() function of userregistration.php from:

    if ( is_subdomain_install() ) {
    		$blog_domain = $blog_address . '.' . preg_replace( '|^www\.|', '',             				   $path      = $current_site->path;
            } else {
                $blog_domain = $current_site->domain;
                $path      = trailingslashit($current_site->path) . $blog_address . '/';
            }

    to:

    if ( is_subdomain_install() ) {
    //added 3/31/14 by BS to work with Multi Domain
    		if (empty($domain_suffix)) {
    			$blog_domain = $blog_address . '.' . preg_replace( '|^www\.|', '', $current_site->domain );
    		} else {
    			$blog_domain = $address . '.' . $domain_suffix;
    		}
                $path      = $current_site->path;
            } else {
                $blog_domain = $current_site->domain;
                $path      = trailingslashit($current_site->path) . $blog_address . '/';
            }

    On the actual form I added a dropdown and manually entered my allowed domains as domain1.com, domain2.com, etc and then in the registration settings screen I selected this field as the 'suffix' field.

    I am going to work a little bit more and see if I can get it to detect the presence of Multi Domain and only enable the 'suffix' field if it finds the plugin as well as see if I can come up with a way to pull the allowed domains from the Multi Domain plugin.

    Hopefully this will help others trying to do the same thing.

    Thanks,
    Brian

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.