Might have found a bug in the pro-site sign up without wp-sign up

Playing with pro-sites sign up, going to:

https://mynetwork.com/wp-admin/network/admin.php?page=psts-settings

Then I have the option:
Signup on Checkout
Disables WordPress Signup

Checked.

Then when not logged in and visiting:

https://mynetwork.com/pro-site/

I choose a package reviewing the username, password, email, site title, site address fields.

I fill those out select "Reserve your site" and green check boxes show up next to the site title site address.

The stripe credit card info does not show up. If I then choose a different package, then the credit card info shows up.

So somewhere the javascript isn't firing properly to reveal the credit card form after pushing reserve your site.

  • Predrag Dubajic

    Hey Ben,

    Thanks for the info, I have checked your site and it looks like hidden class is not being removed from checkout holder and thus keeping it hidden on the page, there are no any console errors that point to failing script.

    Would you mind allowing support access so we can have a closer look at your setup?
    To enable support access you can follow this guide here:
    https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Best regards,
    Predrag

  • Ben

    @Predrag Dubajic

    Did more testing, i think there is a bug in the logic that needs reviewing asap as from what I can see...because if people set it up to use prosites for registration...it can't see how it would work and I'm guessing some testing wasn't done....could be wrong though. Please review the following.

    Following the logic of file: pro-sites-files/js/checkout.js it will eventually go to the function:

    post_registration_process

    It will then hit conditional call:
    if ( typeof response.gateways_form != 'undefined' ) {

    in this conditional call is where it should be removing the hidden class from the gateway:

    if ( !is_free ) {
         $( '.gateways.checkout-gateways' ).removeClass( 'hidden' );
    }

    however simply inserting console output before the conditional call reviews that response.gateways_form is undefined and thus never removing the hidden class...

    There could be other logic I am not following or seeing, however if I am not wrong this looks to be a HUGE bug as it will completely block people from signing up if they are using the pro-sites option for account creation and should be reviewed asap. In addition to your testing, I'd like to here the thoughts from @Rheinard on this problem.

    Support access open.

    Merry Christmas

  • Predrag Dubajic

    @PatrickHi Ben,

    Thanks for the info, however when testing this on my installation the script is working properly and "hidden" class gets removed once I reserve a site and checkout form is shown.
    @Rheinard is currently away for christmas but hopefully he will be able to give more info once he's back.

    I wanted to check if it's something related to specific Pro Site settings you are using but I keep getting 502 error when trying to use support access on your site.

    Could you send me your login details via contact form so I could login that way and do some further testing until Rheinard is back?

    You can send us your details using our contact form https://premium.wpmudev.org/contact/ and the template below:

    IMPORTANT: Make sure you select "I have a different question" for your topic so it doesn't go back to forums - this and the subject line ensure that it gets assigned to me.

    Subject: "Attn: Predrag Dubajic"
    - WordPress admin username
    - WordPress admin password
    - login url
    - link back to this thread for reference
    - any other relevant urls

    Best regards,
    Predrag

  • Ben

    @Predrag Dubajic

    To be clear, what are the steps you took to do that sign up.

    Want to make sure you are attempting to sign up via the https://mydomain.com/pro-site/ and not the signup via wordpress method which I have as the current publically viewable method of sign up.

    If you are doing the signup via https://mydomain.com/pro-site/

    Can you do the following as a test:

    Don't make a selection of annual vs monthly (default is monthly)

    Choose the lowest priced package (the one in the middle not the free one)

    Fill out the 5 fields for creating an account/blog

    If you are doing other steps than what is listed, can you describe your steps.

    Thanks.

  • Predrag Dubajic

    Hi Ben,

    I'm sorry if I was unclear in my above responses, I actually CAN replicate the issue on your installation, however when I test it on my test site I'm not seeing this issue.

    That's why I was asking for login details, I would like to compare your Pro Sites settings with the ones on my installation and see if something from there is actually causing different behaviours.

    Best regards,
    Predrag

  • Predrag Dubajic

    Hi Ben,

    Sorry I missed the email somehow, I did indeed got your details.

    I was doing some additional testing on my site with the exact same Pro Sites settings as you have on your site and still the payment form is shown.

    I checked the theme you're using and based on its CSS file it looks like this theme is based on Twenty Thirteen theme, so I went and tested on my installation with Twenty Thirteen but again no luck in replicating it, form is still there.

    That being said, I believe there's a conflict on your site, either with the theme you're using or some of other plugins you have activated, could you please run a basic troubleshooting by switching to default WP theme and disabling your other plugins, this will tell us more about what is happening here.

    Best regards,
    Predrag

  • Ben

    in the function "post_registration_process" in the file:

    will you add the following line:

    console.log('gateways_form: ' + typeof response.gateways_form);

    just before the line that says:

    if ( typeof response.gateways_form != 'undefined' ) {

    And then I would love to test your site. I'd rather avoid dismantling a live site with multiple live customers. Lets leave that for last option!

    Please let me know or PM me where to test your site!

    Thanks

  • Adam Czajczyk

    Hello Ben,

    I hope you're well today!

    I understand that you're cautious if it comes to testing issues on your live site. I have noticed though, that you have granted a support access to your dashboard so I tried to log-in in order to compare your site's settings with my own. Unfortunately, I wasn't able so could you please check if there are no e.g. IP geo-restrictions and support access is still granted? If it's not valid already cold you please re-grant it for me?

    I will not make any changes to your site without your prior consent but I'd really love to check settings in order to replicate this on my sandbox as closely as possible.

    I know that Predrag was able to confirm the issue on your site. I was able to do this as well and I believe there may be some kind of either error or a conflict related to plugins/themes but since we both couldn't replicate this on our ends, I got a feeling that we may be missing some important option/setting/configuration here.

    Best regards,
    Adam

  • Ben

    Another note...and why I think it is related to WPMU dev plugin (plugins)

    If you choose a package to reveal the the account set up, then click the reserver site or create your site button the validation will occur but nothing will happen. THEN if you click on the sign up button again for one of the packages the stripe info will show.

    Would love access to your site for testing and please try inserting that item of javascript code.

    I still believe there is a bug. I tried replacing my theme with the wordpress 2015 theme and had the same results.

  • Ben

    Okay confirming the issue is with a plugin i wrote that would request the phone number during a user signing up. Not sure why it is creating the failure, perhaps you have some ideas on how to collect a users phone number while creating an account? Here is the plugin I wrote that is working with signing up via the wordpress registration system:

    <?php
    /*
    Plugin Name: Custom Profile field as a Registration Field
    Plugin URI: http://mysite.com/
    Description: Plugin for WordPress to request phone number
    Author: Ben
    Version: 0.1
    Author URI: http://mysite.com/
    */
    
    add_action ( 'show_user_profile', 'my_show_extra_profile_fields' );
    add_action ( 'edit_user_profile', 'my_show_extra_profile_fields' );
    
    function my_show_extra_profile_fields ( $user )
    {
    ?>
    	<h3>Extra profile information</h3>
    	<table class="form-table">
    		<tr>
    			<th><label for="user_phone_signup">Customer Phone</label></th>
    			<td>
    				<input type="text" name="user_phone_signup" id="user_phone_signup" value="<?php echo esc_attr( get_the_author_meta( 'user_phone_signup', $user->ID ) ); ?>" class="regular-text" /><br />
    				<span class="description">Please enter your phone number.</span>
    			</td>
    		</tr>
    	</table>
    <?php
    }
    
    add_action ( 'personal_options_update', 'my_save_extra_profile_fields' );
    add_action ( 'edit_user_profile_update', 'my_save_extra_profile_fields' );
    
    function my_save_extra_profile_fields( $user_id )
    {
    	if ( !current_user_can( 'edit_user', $user_id ) )
    		return false;
    	/* Copy and paste this line for additional fields. Make sure to change 'twitter' to the field ID. */
    	update_usermeta( $user_id, 'user_phone_signup', $_POST['user_phone_signup'] );
    }
    
    /**
     * Add cutom field to registration form
     */
    
    add_action('register_form','show_user_phone_signup_field');
    add_action('register_post','check_fields',10,3);
    add_action('user_register', 'register_extra_fields');
    
    function show_user_phone_signup_field()
    {
    ?>
    	<p>
    	<label>Phone Number<br/>
    	<input id="user_phone_signup" type="text" tabindex="30" size="25" value="<?php echo $_POST['user_phone_signup']; ?>" name="user_phone_signup" />
    	</label>
    	</p>
    <?php
    }
    
    function check_fields ( $login, $email, $errors )
    {
    	global $user_phone_signup;
    	if ( $_POST['user_phone_signup'] == '' )
    	{
    		$errors->add( 'empty_user_phone_signup', "<strong>ERROR</strong>: Please Enter your phone number" );
    	}
    	else
    	{
    		$user_phone_signup = $_POST['user_phone_signup'];
    	}
    }
    
    function register_extra_fields ( $user_id, $password = "", $meta = array() )
    {
    	update_user_meta( $user_id, 'user_phone_signup', $_POST['user_phone_signup'] );
    }
    
    ?>
  • Adam Czajczyk

    Hello Ben!

    Thanks for your extensive and detailed replays, that's a great debugging work and really helpful. I've installed your plugin on my multisite sandbox and now I'm able to fully reproduce the issue. Further debugging showed that the part that's causing an issue is:

    add_action('register_post','check_fields',10,3);
    
    /* stripped not relevant code */
    
    function check_fields ( $login, $email, $errors )
    {
    	global $user_phone_signup;
    	if ( $_POST['user_phone_signup'] == '' )
    	{
    		$errors->add( 'empty_user_phone_signup', "<strong>ERROR</strong>: Please Enter your phone number" );
    	}
    	else
    	{
    		$user_phone_signup = $_POST['user_phone_signup'];
    	}
    }

    That said, I can see two issues here worth attention:

    1. As explained here the "register_post" hook should never be used to perform field validation;

    I'm thinking it's returning an error in every case and that's causing an error. In fact, commenting this line:

    $errors->add( 'empty_user_phone_signup', "<strong>ERROR</strong>: Please Enter your phone number" );

    makes signup work again as expected, at least on my setup.

    2. The plugin isn't showing Phone number field anyway. That's a) casing the field to be empty b) therefore triggering an error and c) as a result causing the issue.

    The question then is: do we want to make that additional field appear on Pro Sites signup form or it's intended to be used with other forms on the site and it would be better to "exclude" plugin from Pro Sites signup?

    Looking forward for your replay,
    Adam

  • Ben

    I'm thinking it's returning an error

    Correct it is returning an error because the field isn't being filled out as it should be. So with this normal wordpress hook it should be showing, why is it not showing with the pro-sites flow...is that an error with pro-sites abiding by the proper wordpress standards or am I not programming the right pro-sites standards? I reviewed the signup-password plugin and signup-tos plugin and noticed that they are using different hooks (signup_extra_fields).

    What is the proper wordpress standard way?

    The question then is: do we want to make that additional field appear on Pro Sites signup form or it's intended to be used with other forms on the site and it would be better to "exclude" plugin from Pro Sites signup?

    I definitely want it to show up during the sign up process of pro-sites. Currently if you click the live sign up button at the top when not going through the /pro-sites/ sign up flow you will see it working.

    Should I be re-writing what I wrote to match the signup-wordpress plugin, or should pro-sites be adjusted to properly account for the register_form hook?

  • Adam Czajczyk

    Hello Ben!

    I think the only way to make an additional field appear on the Pro Sites form would be to re-write the plugin slightly. Pro Sites is initially using standard-compliant WP hooks/filters to replace the sign-up form and then is building that form dynamically. Changing/rewriting Pro Sites would actually mean writing it's core features from scratch.

    That said, as I now know exactly what's causing the issue and why it happens as well as what would you like to achieve here, I think it's time to ask Pro Site's developer for help here. I've already asked him if he could lend us a hand here and I'll let you know once I get a response.

    Please note though that his response time may be a bit longer than mine here on forum. Would you please keep an eye on this thread for further information and updates?

    Best regards,
    Adam

  • Adam Czajczyk

    Hello again Ben!

    Just a little update, if you don't mind. Another member of our community is trying to achieve pretty much the same feature with Pro Sites with his own plugin. You may want to take a look here:

    https://premium.wpmudev.org/forums/topic/add-custom-form-field-to-pro-sites-sign-up-form

    I tested the plugin and despite the fact it is actually showing a field, it's causing the same issue as yours. There's however quite a different workflow used there so I thought you may be interested in taking a look.

    Apart from this, I'll of course notify you immediately once I get a response from the developer.

    Best regards,
    Adam

  • Ben

    @Adam Czajczyk

    Boy oh boy, thanks for your patience on this. I have finally followed the code even further.

    btw...using anti-splog here, and per the anti-splog usage, i created a file:

    custom-wpsignup.php

    That anti-splog reads in and then on that file I am adding the phone field.

    However the pro-sites doesn't read in the antisplog file, and as a result the field isn't there and so then the check is checking nothing....now its all making sense!

    Reviewing further..

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.