• Resolved midnitedev

    (@midnitedev)


    Hello there,

    We are currently having an issue on Paid Membership Pro plugin which states the ff: “There are JavaScript errors on the page. Please contact the webmaster.” when trying to upgrade a free trial user to a paid member. We can’t narrow down the specific issue because it does not show any errors on javascript in console regarding details.

    This is process is being done through the checkout page for free trial users: https://livinglegacies.com/my-account/plan-checkout/

    To recreate the issue, here are the steps:
    1) Create free trial member.
    2) Head to https://livinglegacies.com/my-account/plan-checkout/
    3) Fill out all required fields including payment information
    4) Click the “submit and checkout” button
    5) See error stated above

    Previous access was requested by someone from PMpro to test out another issue and we gave them access to the site. It’s a paid (test) membership. We opened a support ticket but we’re not getting a lot of updates from the person who’s on the ticket, and we really need this resolved since this has been a problem for a while and we’re trying to fix it and close this issue. I’ve tested out several solutions now, including disabling plugins one by one, modifying page template checkout.php, testing add-ons, removing captcha, etc., but so far none have worked. I’ve narrowed down the cause of the issue to being a preheader file for checkout.

    Plugin Information:
    Plugin info:
    PMPro Version 2.2.6
    Add-ons:
    Email Confirmation Add On
    Email Templates Add On
    Extra Expiration Warning Emails Add On
    Member Homepages Add On
    Register Helper Add On
    WooCommerce Add On

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Andrew Lima

    (@andrewza)

    Hi @midnitedev

    Thank you for using Paid Memberships Pro. Please note that login details should not be shared on this support channel and issues only relating to Paid Memberships Pro core should be handled.

    If you have a Plus membership, please reach out via https://www.paidmembershipspro.com so one of our support engineers can assist you further.

    The JavaScript issue may be generated once you click submit, please could you recreate this issue and open your console on your browser and let me know if there are any errors logged there as this may help us pinpoint where the issue is coming from (as this is a site specific issue).

    Thread Starter midnitedev

    (@midnitedev)

    Hi Andrew,

    I have been able to recreate this issue again, but I’m not getting any javascript errors. The only console notes and warnings I get are the ff when pressing submit:

    JQMIGRATE: Migrate is installed, version 1.4.1
    DevTools failed to parse SourceMap: https://duoypevs5mcpk.cloudfront.net/wp-content/themes/livinglegacy/includes/js/bootstrap.min.js.map
    DevTools failed to parse SourceMap: https://duoypevs5mcpk.cloudfront.net/wp-content/themes/livinglegacy/includes/css/bootstrap.min.css.map

    That is it. The condition is triggered by this specific snippet in …/paid-memberships-pro/preheaders/checkout.php:

    //make sure javascript is ok
    	if ( apply_filters( "pmpro_require_javascript_for_checkout", true ) && ! empty( $_REQUEST['checkjavascript'] ) && empty( $_REQUEST['javascriptok'] ) ) {
    		pmpro_setMessage( __( "There are JavaScript errors on the page. Please contact the webmaster.", 'paid-memberships-pro' ), "pmpro_error" );
    	}
    Plugin Author Andrew Lima

    (@andrewza)

    Thanks for the feedback, would you mind testing this with the default TwentyTwenty theme enabled?

    To confirm, you have disabled all plugins except Paid Memberships Pro and the issue still persists?

    Do you have any plugins that may minify/combine JavaScript files?

    Thread Starter midnitedev

    (@midnitedev)

    Thanks, now I’m getting somewhere. So previously I already tried disabling plugins (plugin User Menus left because it breaks the site, PMPro left as well including its add-ons), I redid the same thing today and tested it prior and still got the same error. I switched to the Twenty Twenty theme and now the free trial to paid membership successfully processed.

    Thread Starter midnitedev

    (@midnitedev)

    So I’m currently focusing on the custom checkout.php page where the customizations are made. As far as the customizations, the ones added are css styles, js code to toggle a specific section of code on a checkbox status:

    jQuery(document).ready(function(){
    
    		jQuery('#add_admin_contact').on('click',function (e){
    		    jQuery('#pmpro_administrative_fields').toggle();
    		});
    	})

    the html/php code to show related to the code above:

    <div id="pmpro_administrative_fields" class="pmpro_checkout" style="display:none;">
    				<h3>
    					<span class="pmpro_checkout-h3-name"><?php _e('Trusted Personal Contact', 'paid-memberships-pro' );?></span>
    				</h3>
    			</div> 

    and the header code:

    <div id="signUpHeader" class="lazy-load-bg">
    		<img data-src="/images/signup-img.png">
    
    			<p style="display: none;">
    				<?php printf(__('You have selected the <strong>%s</strong> membership level.', 'paid-memberships-pro' ), $pmpro_level->name);?>
    			</p>
    			<?php
    				/**
    				 * All devs to filter the level description at checkout.
    				 * We also have a function in includes/filters.php that applies the the_content filters to this description.
    				 * @param string $description The level description.
    				 * @param object $pmpro_level The PMPro Level object.
    				 */
    				$level_description = apply_filters('pmpro_level_description', $pmpro_level->description, $pmpro_level);
    				if(!empty($level_description))
    					echo $level_description;
    			?>
    
    	</div>

    I’m fairly sure these code parts are not causing the issue. I keep going back to this code:

    //make sure javascript is ok
    	if ( apply_filters( "pmpro_require_javascript_for_checkout", true ) && ! empty( $_REQUEST['checkjavascript'] ) && empty( $_REQUEST['javascriptok'] ) ) {
    		pmpro_setMessage( __( "There are JavaScript errors on the page. Please contact the webmaster.", 'paid-memberships-pro' ), "pmpro_error" );
    	}

    since this is what I find to be executing (it works on free trial and paid signups but fails on free trial to paid transition). javascriptok and checkjavascript variables are both 1 on all levels (regular signup, free trial and free trial to paid) so it can’t be on these variables. That leaves pmpro_require_javascript_for_checkout.

    Btw, I couldn’t find anything much on pmpro_require_javascript_for_checkout. The only reference to it is from /plugins/paid-memberships-pro/preheaders/checkout.php

    Plugin Author Andrew Lima

    (@andrewza)

    Thank you for your feedback, have you managed to make progress on this issue?

    Our support doesn’t cover troubleshooting of issues generated from customizations done to Paid Memberships Pro. I’d recommend in reaching out to a local WordPress developer if you need assistance in resolving/troubleshooting your custom code.

    Thread Starter midnitedev

    (@midnitedev)

    I’ve fixed the issue. Thank you for your help.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Error when upgrading a free trial user to a paid member’ is closed to new replies.