Title: Unexpected Error
Last modified: August 21, 2016

---

# Unexpected Error

 *  Resolved [Mike Warren](https://wordpress.org/support/users/mike-warren-1/)
 * (@mike-warren-1)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/unexpected-error-12/)
 * I have installed the email-subscribers plugin, but get an unexpected error when
   trying to register via the widget.
 * I’ve uncommented the alert(xmlHttp.readyState) and alert(xmlHttp.responseText)
   lines from the JavaScript files and get a series of message boxes counting from
   1 to 4, with blank ones in between. The message boxes just before and after the“
   4” say “unexpected-error”.
 * I have previously used the Subscribe2 plugin without any problems
 * I have tried disabling _all_ other plugins, thinking it might be a compatibility
   problem, but still the error persists.
 * I have also installed this plugin on a test site, using the same theme (Suffusion)
   and the same host (ixWeb), and that one works without problems.
 * I really don’t know where to go from here with diagnosing the problem. It’s obviously
   not a fundamental problem with the plugin, but I need some way of gaining more
   diagnostic information.
 * [https://wordpress.org/plugins/email-subscribers/](https://wordpress.org/plugins/email-subscribers/)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [gopiplus](https://wordpress.org/support/users/gopiplus/)
 * (@gopiplus)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/unexpected-error-12/#post-5018931)
 * File : job/es-subscribe.php
    Code : if (strpos($_SERVER[‘HTTP_REFERER’], get_option(‘
   siteurl’)) !== false) { //Code in this block is required don’t remove. } else{
   echo “unexpected-error”; }
 * Remove/Comment this IF condition from the file and try again.
 *  Thread Starter [Mike Warren](https://wordpress.org/support/users/mike-warren-1/)
 * (@mike-warren-1)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/unexpected-error-12/#post-5018939)
 * Thanks for your reply, Gopi. That indeed fixed the problem, but obviously I’d
   rather fix it without altering your code if that’s possible.
 * Do you have any suggestions for what might be wrong to make that test fail?
 *  [gopiplus](https://wordpress.org/support/users/gopiplus/)
 * (@gopiplus)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/unexpected-error-12/#post-5019003)
 * Hi Mike,
 * I have little check in that place to confirm emails are submitted from the same
   URL (For extra security). Your WordPress has been configured different folder
   structure. Thus your wp variable (siteurl) is different from HTTP_REFERER.
 * At present no other solution for this.
 *  Thread Starter [Mike Warren](https://wordpress.org/support/users/mike-warren-1/)
 * (@mike-warren-1)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/unexpected-error-12/#post-5019065)
 * I’m not familiar with JavaScript, but I assume strpos looks for the occurrence
   of the first string in the second.
 * In my case, the directory WordPress is installed in is [http://mysite.com/site](http://mysite.com/site)
   so surely a test for the occurrence of [http://mysite.com](http://mysite.com)
   would return true?
 *  [gopiplus](https://wordpress.org/support/users/gopiplus/)
 * (@gopiplus)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/unexpected-error-12/#post-5019080)
 * 1. Your wp is configured on this [http://mysite.com/site](http://mysite.com/site)
   Thus your siteurl is [http://mysite.com/site](http://mysite.com/site)
 * 2. Your browsing the site on this URL [http://mysite.com](http://mysite.com)
 * Condition failed, your siteurl ([http://mysite.com/site](http://mysite.com/site))
   is not available on actual URL ([http://mysite.com](http://mysite.com))
 * Please follow my first solution and let me know if you have any other best solution.
   Thanks
 *  Thread Starter [Mike Warren](https://wordpress.org/support/users/mike-warren-1/)
 * (@mike-warren-1)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/unexpected-error-12/#post-5019095)
 * I’m sure I’m missing something, but won’t this work in both cases if you just
   reverse the strings?
 * if (strpos(get_option(‘siteurl’), $_SERVER[‘HTTP_REFERER’]) !== false)
 * Or will that cause other problems?
 * ——————————————
 * Okay, I just tried it and it doesn’t work, so I’m obviously not understanding
   how this stuff works.
 * I’ll leave the test commented out and continue playing with the plugin.
 * Thanks for your help, and thanks for the plugin.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Unexpected Error’ is closed to new replies.

 * ![](https://ps.w.org/email-subscribers/assets/icon-256x256.png?rev=2274172)
 * [Email Subscribers & Newsletters - Email Marketing, Post Notifications & Newsletter Plugin for WordPress](https://wordpress.org/plugins/email-subscribers/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/email-subscribers/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/email-subscribers/)
 * [Active Topics](https://wordpress.org/support/plugin/email-subscribers/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/email-subscribers/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/email-subscribers/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Mike Warren](https://wordpress.org/support/users/mike-warren-1/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/unexpected-error-12/#post-5019095)
 * Status: resolved