WP Ultimo registration error.

I am using WP Ultimo for my multisite subdomain setup and during registration, when a user registers and applies a discount coupon, it gives an error.
So I tried to make a staging site to run a plugin conflict test and debugging, but right after I create the staging and do testing, everything works fine on the staging.
Would you please help me to figure out why it works on the staging and not on the production site? And how to solve this error?

  • Nithin Ramdas
    • Support Wizard

    Hi Wayne ,

    We gave a closer look, and could notice the anomalies in Live site but not on Staging, which is an odd use case.

    Could notice debug logs generated in the Live site, but I’m afraid it doesn’t help much in pinpointing what might have caused the issue in Live.

    It seems like the staging has some changes compared to live when I test the templates during the signup process, could we know whether is it okay, if we could reset the Staging site to ensure there isn’t anything being missed in staging so that we could further troubleshoot the anomalies noticed?

    Looking forward to your response.

    Regards,
    Nithin

  • Nithin Ramdas
    • Support Wizard

    Hi Wayne ,

    Thanks for the update. We further tested this out and tried to replicate this on the staging but it seems to work fine on staging, but causes the issues mentioned on Live site.

    When the error occurs in Live site it does send an email to admin:
    [attachments are only viewable by logged-in members]

    Could we know whether you got any such email? If yes, does it mention any errors or logs that we could look at? If yes, please do share.

    Tried enabling debug mode but I’m afraid, it doesn’t show any related logs that we could look at. We also brought this into our Hosting team’s attention to see whether it’s anything specific to Host, but they seem to pinpoint it seems to be more of an existing plugin causing a conflict.

    I’m escalating this further to our Second Level Support(SLS) teams attention to see whether they could help in figuring out what’s causing this. If they aren’t able to help much regarding the anomaly notice, then I’m afraid we could only suggest running a conflict test on Live site too.

    Will keep you posted once I get further feedback from our SLS team asap.

    Regards,
    Nithin

  • Joe
    • Designer

    Hi Nithin,

    Thanks for the update. I did not receive any email for that issue at all.

    Ya. Previously also tried to look at debug log but didn’t get anything from there. Thats why i tried to do a plugin conflict in staging but its weird that everything works well on staging.

    The reason why I’m still on hold to do a plugin conflict on production site is because that this is already a live site and I cant deactivate plugins which will create malfunction for my customers subsites.

  • Mohammad Sharab
    • PM

    Hi Wayne ,
    I hope you are doing well today.

    For further investigation, I’ve deleted the Staging site and re-created a new one, which should be the same as resting the staging site. But oddly the new staging site is showing ERR_TOO_MANY_REDIRECTS error. I’ve updated our Second Line Support with this error and I could see that our Second Line Support is still working on this issue.

    Kindly note that due to the complexity of this issue, it might take a little while. We will update you here as soon as we get anything from them. We really appreciate your patience.

    Best regards,
    Mohammad Sharab

  • Ash
    • Code Norris

    Hello Wayne

    As this is moved to our second line support team, so for now, let’s keep the staging site like that. Also, the staging site is sometimes inaccessible. So, I would rather some more time, let the SLS team to take a look and then proceed further.

    Have a great day :slight_smile:

    Cheers,
    Ash

  • Panos
    • SLS

    Hi Wayne and sorry for delay.

    As there is nothing in logs it makes it hard to debug. I’m not sure why there are no logs even when trying to make custom ones with error_log. Loging might be blocked in theme or some plugin for some reason, but can’t run a plugin/theme conflict as it is a live site.

    It is a 3rd party plugin and we are not familiar with it, so there is a lot to check which adds more time. After a lot of checking, the culprit seems to be this callback:
    WP_Ultimo_AffiliateWP::create_tracking_coupon
    which hooks on this action:
    wp_ultimo_apply_coupon_code

    I think this is from the WP Ultimo: AffiliateWP Integration plugin, as the class name mentions that. I’m not sure if there is any php error or if this just requires too many resources which makes site timeout as there are no logs. I’ll try check if there is any easy way around this and will keep you posted

    Kind regards!

  • Panos
    • SLS

    I just did some more tests and realized that the WP Ultimo: AffiliateWP Integration plugin requires the AffiliateWP plugin to be active, which is not (at least not network active). You can either try network activating it or disabling WP Ultimo: AffiliateWP Integration plugin and see if you still get this error message.

    Kind regards!

  • Joe
    • Designer

    Hi panos

    So sorry for the late reply on this.

    I did try to network activate AffiliateWP but it did not help with the issue.

    I also did a quite plugin conflict on my live site just a moment ago. And i’m totally frustrated that cant really find the culprit of it.

    Months ago I did a plugin conflict by deactivating Ultimo AffiliateWP Integration and registration went well. I reported this to ultimo but they told that it has nothing to do with Ultimo Affiliate WP Integration. Do you have a more concrete proof that i can show it to Ultimo that its in fact Ultimo AffiliateWP Integration that causing the problem.

    Besides, its also weird that the registration went well on staging site. So this let me suspect that could it be some kind of cache that causing this issue? Means that when we push production site to staging site, does the pushing exclude some of the cache files or does it regenerate a new files for cdn purpose?

    Can we do it this way? We make a full backup of the production site and do a testing on production site. Then after everything is done, restore the backup. But this only can be done during the time of
    SGT0200 – SGT0500 (Singapore Time, GMT+8).

  • Panos
    • SLS

    I also tested by activating AffiliateWP but still got the same issue. However it’s still related, I’ll try explain the technical parts as clear as possible :slight_smile:

    As mentioned above, in this action, wp_ultimo_apply_coupon_code the WP_Ultimo_AffiliateWP::create_tracking_coupon is hooked. That does:
    $visit_id = $this->save_visit($coupon->affiliate);
    Which ( save_visit() ) calls a webhook of the AfiliateWP plugin using wp_remote_post. But since the AffilaiteWP plugin is inactive, that return a WP_Error object.

    There is nothing wrong up to this part. Now back in WP_Ultimo_AffiliateWP::create_tracking_coupon it tries to log the response:
    WU_Logger::add('affiliatewp', "Visit: $visit_id");
    As we said, $visit_id is an (WP_Error) object but it is used as a text so it throws an error there, which unfortunately can not see for some reason, as some plugin is blocking error logging.

    You can chat more about that with the WP Ultimo team. In the meantime I have added a mu-plugin here :
    wp-content/mu-plugins/wpmudev-ultimo-wpa.php
    with the following snippet:

    add_action( 'wp_ultimo_apply_coupon_code', function( $coupon, $subscription ){
    
        $wu_waff = WP_Ultimo_AffiliateWP::get_instance();
    
        // Remove adding affiliate in this step so we lower the stress
        remove_action( 'wp_ultimo_apply_coupon_code', array( $wu_waff, 'create_tracking_coupon' ), 10 );
    
        // Check if this user was tracked already
        $tracked = get_option('wp-ultimo-affiliatewp-tracked', false);
    
        if ($tracked == false && $subscription && $coupon->affiliate) {
    
            /**
             * First of all, we need to track that visit
             */
            $visit_id = $wu_waff->save_visit($coupon->affiliate);
    
            //WU_Logger::add('affiliatewp', "Visit: $visit_id");
    
            if (is_wp_error($visit_id)) {
                WU_Logger::add('affiliatewp', "Visit: NONE");
                return;
            } // end if;
    
            WU_Logger::add('affiliatewp', "Visit: $visit_id");
    
            $user = get_user_by('id', $subscription->user_id);
    
            $affiliate = $coupon->affiliate;
            $desc      = sprintf(__('Referred user %1$s via coupon code %2$s.', 'wp-ultimo-affiliatewp'), $user->display_name, $coupon->title);
    
            /** Saves the Tracking */
            $result = $wu_waff->save_tracking($affiliate, $visit_id, $desc, $subscription);
    
            WU_Logger::add('affiliatewp', "Tracking: $result");
    
        } // end if;
    
    }, 1, 2 );

    What the above does is override original WP_Ultimo_AffiliateWP::create_tracking_coupon callback, then it follows all the steps in that function, but places that log part that is throwing the error after the :
    if (is_wp_error($visit_id)) {
    condition check.

    Hope this clarifies a bit.

    Kind regards!

  • Joe
    • Designer

    Hi thank you for your help and really appreciate that…

    May I clarify thing below?:
    1) but is there any reason that after pushing production site to staging, the issue cannot be reproduce in staging. Everything in staging suppose to be exactly the same as production right?

    2) with the code added in MU plugin, does that mean that for the time being, the coupon is working at least for now until ultimo come up with a solution?

    As for the clarification you explain, i will pass it to ultimo and hopefully they will understand (even someone like me can understand some of it…hahaha).

    For now, please allow me some time to get to ultimo.

    Thanks alot.

  • Panos
    • SLS

    Hey Wayne ! So about 1, on staging site, it asks for Authentication on such remote requests (the popup asking for username and password), so the response is not a WP_Error object, it’s a string (that says you need to enter username and password), so this line :
    WU_Logger::add('affiliatewp', "Visit: $visit_id");
    that throws error on production site, here is wouldn’t throw error, it would though log wrong information. But the process is not blocked.

    As for 2, yeah it should work fine but you need to confirm if all works as expected on your side too. It would be great if Ultimo devs could check this out too.

    One note, without being familiar with any of these 3rd party plugins, I believe that you either don’t need WP Ultimo: AffiliateWP Integration plugin, or you need to activate AffiliateWP too. Of course this is without having any experience on those plugins so just mentioning this.

    Kind regards!

  • Joe
    • Designer

    Hi

    Really thanks for all the effort to find out the problem and writing a code to overwrite the problematic code. I’ve sent all info to ultimo support. They will forward it to their technical team to have a look into it. Hopefully they will come back with a solution on that.

    As to reply to your last statement, my AffiliateWP is activated on my main site (not the network because all my subsites do not need AffiliateWP plugin.

  • Panos
    • SLS

    I didn’t notice that WP Affiliate was active on main site. In that case it shouldn’t throw an error (since sign up page is on main site), instead it should get response from the wp remote call. I could have a look on that shortly, but I’d need your consent again as this can’t be checked on the staging site, only on production.

    I’m not sure how to check those coupons on the site, so in the meanwhile could you check if all info you need is there after signup (coupons, affiliate id etc). If all is good we don’t need to continue debugging that, if there is something missing though it’s worth having another look, so in that case I’d need to do more testing on production site

    Kind regards!

  • Joe
    • Designer

    Hi, i’ve just checked and i’m sure that the AffiliateWP is activated on my main site. And yesterday right after you add the code, i did try on the registration with applying the coupon and it went well without error.

  • Panos
    • SLS

    Not having the error is one part, but having WP Affiliates returning a WP Error message instead of visit_id makes me suspect that affiliate is not added, or not doing what it’s supposed to do, upon sign up. So what I meant was not only checking if signup gets completed, but also if affiliates, referral urls etc are all as they should