• Resolved hand_coding

    (@hand_coding)


    I continuously experience this problem without finding any solution.
    Anytime I try to subscribe without being logged in, the response is the same:

    Oops! There is a problem with this form:
    textStatus:parsererror
    errorThrown:SyntaxError: syntax error
    responseText:

    Followed by the blog home page on a red background as the responseText.
    This happens whatever method I use (php, iFrame, …).

    screenshot1
    screenshot2

    This error doesn’t show up when logged in and the subscription goes fine.
    It looks like the error reported on this post a year ago but I couldn’t find any reference to it on the “Knowledgebase“.

    Any clue?
    Please help.

    Fabrice

    https://www.ads-software.com/plugins/wysija-newsletters/

Viewing 15 replies - 1 through 15 (of 15 total)
  • Thread Starter hand_coding

    (@hand_coding)

    Safari on Mac is a bit more talkative:

    Oops! There is a problem with this form:
    textStatus:parsererror
    errorThrown:SyntaxError: Unexpected token '<'
    responseText:

    Fabrice

    Thread Starter hand_coding

    (@hand_coding)

    I’ve found the culprit.
    It’s a function one add to function.php to prevent users to access the dashboard.
    It goes like this:

    add_action('admin_init', 'no_mo_dashboard');
    function no_mo_dashboard() {
      if (!current_user_can('manage_options') && $_SERVER['DOING_AJAX'] != '/wp-admin/admin-ajax.php') {
      wp_redirect(home_url()); exit;
      }
    }

    You can find it here,
    It works like a charm but obviously ruins the wysija mechanism (and probably others).
    I have no idea on how to modify this hook to make it work with wysija.
    I will try to get in touch with Drew Jaynes who also developed a wp plugin for this.

    Fabrice

    Thread Starter hand_coding

    (@hand_coding)

    Hi Fabrice,

    I am having the same problem on a Wysija subscription form that I have generated (HTML) from the forms page in Wysija settings.

    I also see it working perfectly when logged in as admin.

    My problem is not identical to yours since I cannot find that function anywhere in my code.

    Have you had any progress that could be helpful to me?

    Thread Starter hand_coding

    (@hand_coding)

    Not really. I found out that this function was the cause, then I replaced it with the plugin. It turned out the plugin works well without troubling wysija.
    Is your function.php pristine or did you add some custom functions?
    Did you make some test with all plugins disabled except wysija?

    Fabrice

    Thread Starter hand_coding

    (@hand_coding)

    Also, if your theme structure allows it, make a test with a default theme (like TwentyTwelve).

    Thread Starter hand_coding

    (@hand_coding)

    As ideas comes out: do you use any ajax plugin?

    My theme has a lot of plugins built in – I did test with only theme and wysija – still gives error when not admin logged in.

    I have not made any changes to the way admin-ajax.php is used.

    I will do some more conflict testing and update here.

    Do let us know what you find out!

    I am having the same problem. The form works just fine when I’m logged in but others are unable to subscribe. Apparently this has been going on since JULY and only found out about it today because a customer kindly emailed me when she had trouble.

    PS I was unable to send a support request through the wysija website. The form just doesn’t work.

    Very disappointed….

    Thread Starter hand_coding

    (@hand_coding)

    And what did you do to try to find the cause of the problem?
    Please provide at least some details on your setup.
    The only thing I know so far, is that a function in my code was preventing the correct execution of the ajax part of the wysija plugin.

    I am currently trying the solution here:

    https://stackoverflow.com/questions/11011317/wordpress-plugin-works-only-for-logged-users

    Will post feedback tomorrow.

    I know this isn’t much help to you but over the weekend (while trying to fix this) I broke my theme and ended up having to start from scratch using a different theme — this fixed the signup issue. I know VERY LITTLE about the function file which is how I broke my old theme so I’m afraid I have no idea what was in there that broke the sign up form.

    RESOLVED.

    I used dnGREP to search my plugin folder for admin_init and found this function in one of the plugins that are required by my theme:

    function atcf_prevent_admin_access() {
    	if ( current_user_can( 'submit_campaigns' ) && ! current_user_can( 'edit_posts' ) ) {
    		wp_safe_redirect( home_url() );
    		exit;
    	}
    }
    add_action( 'admin_init', 'atcf_prevent_admin_access', 1 );

    As you know my error includes a red alert box with the home screen inside. I immediately knew this was the conflict, since this function would disallow any non-admin to run ajax from the wp-admin folder.

    I insterted a condition to check for running ajax so the code looks like this:

    function atcf_prevent_admin_access() {
    	if ( current_user_can( 'submit_campaigns' ) && ! current_user_can( 'edit_posts' ) && $_SERVER['PHP_SELF'] != '/wp-admin/admin-ajax.php' ) {
    		wp_safe_redirect( home_url() );
    		exit;
    	}
    }
    add_action( 'admin_init', 'atcf_prevent_admin_access', 1 );

    tested and all working 100%.

    My advice to you: Search your plugin and theme folders for a similar function that restricts access to admin-ajax.php since MAILPOET needs to access this file to use ajax for the proper functioning of their subscription form. Good Luck.

    Jatsie

    Thank you very much. I also use MAILPOeT and had blocked access to the admin panel. Needed to do what you reported to work.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘"Oops! There is a problem with this form"’ is closed to new replies.