Safari on Mac is a bit more talkative:
Oops! There is a problem with this form:
textStatus:parsererror
errorThrown:SyntaxError: Unexpected token '<'
responseText:
Fabrice
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
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?
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
Also, if your theme structure allows it, make a test with a default theme (like TwentyTwelve).
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….
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 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.