• Resolved webbernaut

    (@webbernaut)


    I can’t seem to create an membership. Getting: There are JavaScript errors on the page. Please contact the webmaster.

    Console shows no js errors, disabled all plugins but PMPro.
    Tried By Mail payment option as well as PayPal Standard. Still same error.

    How can I trouble shoot this? I don’t see anything in Network either in my console.

    What kind of message is this? Doesn’t give me any clue to what the problem is! Anyway to update this message to something more specific, this is the worst error message ever.

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

    (@andrewza)

    Hi @webbernaut,

    Thank you for using Paid Memberships Pro, I’m really sorry for the issue you are facing here.

    The best way to test this is to see if there is a conflict with your theme or other plugins. To test conflicts you may do the following:

    1. Temporarily disable all plugins except for Paid Memberships Pro (Disable any Add Ons you may have for Paid Memberships Pro – DO NOT DELETE THE PLUGINS).
    2. Temporarily set your theme to TwentySeventeen.
    3. Retest your checkout to see if the issue persists – if not there was a conflict.
    4. If in step 3 you could checkout okay, start activating one plugin at a time and see if the issue reappears. The last plugin or theme activated was the culprit.

    Sometimes this issue could be caused by your site loading more than one instance of jQuery. I think if you are using any plugin that may heavily use JavaScript would be good to deactivate first before retesting your checkout.

    I hope this helps.

    Thread Starter webbernaut

    (@webbernaut)

    As mentioned in original post I had already disabled all plugins with no luck on fixing the problem. I didn’t think to disable my theme.

    After much trouble shooting (you really need a better error message system), I finally figured out the issue. It was not a javascript error or conflict. This was the first thing I was changing in my theme after TwentySeventeen worked fine on checkout. Removing all enqueued javascript files in my theme didn’t change anything on error message.

    I have a custom theme with a few security functions. One particular function strips out all html comments on code output. For some reason this was causing your plugin to spit out the javascript error message on checkout.

    Some html comments display the version numbers of plugins, which I feel is very bad practice with vulnerabilities being discovered daily. (I also strip out version numbers on scripts but this didn’t seem to be an issue the error I was getting).

    This seems to have resolved the issue, but curious as to why I can’t strip out HTML comments with your plugin. I would really like to do that for security purposes…

    Thread Starter webbernaut

    (@webbernaut)

    Actually it looks like all your javascript is wrapped in an HTML comment…

    <script>
    <!--
    	// Find ALL <form> tags on your page
    	jQuery('form').submit(function(){
    		// On submit disable its submit button
    		jQuery('input[type=submit]', this).attr('disabled', 'disabled');
    		jQuery('input[type=image]', this).attr('disabled', 'disabled');
    		jQuery('#pmpro_processing_message').css('visibility', 'visible');
    	});
    
    	//iOS Safari fix (see: https://stackoverflow.com/questions/20210093/stop-safari-on-ios7-prompting-to-save-card-data)
    	var userAgent = window.navigator.userAgent;
    	if(userAgent.match(/iPad/i) || userAgent.match(/iPhone/i)) {
    		jQuery('input[type=submit]').click(function() {
    			try{
    				jQuery("input[type=password]").attr("type", "hidden");
    			} catch(ex){
    				try {
    					jQuery("input[type=password]").prop("type", "hidden");
    				} catch(ex) {}
    			}
    		});
    	}
    
    	//add required to required fields
    	jQuery('.pmpro_required').after('<span class="pmpro_asterisk"> <abbr title="Required Field">*</abbr></span>');
    
    	//unhighlight error fields when the user edits them
    	jQuery('.pmpro_error').bind("change keyup input", function() {
    		jQuery(this).removeClass('pmpro_error');
    	});
    
    	//click apply button on enter in discount code box
    	jQuery('#discount_code').keydown(function (e){
    	    if(e.keyCode == 13){
    		   e.preventDefault();
    		   jQuery('#discount_code_button').click();
    	    }
    	});
    
    	//hide apply button if a discount code was passed in
    	
    	//click apply button on enter in *other* discount code box
    	jQuery('#other_discount_code').keydown(function (e){
    	    if(e.keyCode == 13){
    		   e.preventDefault();
    		   jQuery('#other_discount_code_button').click();
    	    }
    	});
    -->
    </script>
    
    Plugin Author Andrew Lima

    (@andrewza)

    Thank you for the feedback, we are working on improving the way we handle our JavaScript to avoid cases like this.

    Please feel free to open a new support thread should you have any further questions.

    I found this thread and it helped me to figure out that the default settings for plugin “Webcraftic Clearfy” are incompatible with the Membership plugin. I had to disable the function Defense/RemoveHtmlComments.

    Please update the membership plugin so that it doesn’t break when installing security tools like this.

    Plugin Author Andrew Lima

    (@andrewza)

    @jonashogstrom, we are working on improving how JavaScript is handled and should be updated in the near future.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘There are JavaScript errors on the page. Please contact the webmaster.’ is closed to new replies.