Support

Home Forums Event Espresso Premium No direct script access allowed theme error

No direct script access allowed theme error

Posted: July 21, 2016 at 2:31 pm


Joshua

July 21, 2016 at 2:31 pm

I’ve got EE4 in a development stage and everything worked fine up to a month ago. All of a sudden I got a blank screen with the following error message:

No direct script access allowed

I’ve tried to update the EE4 plugin to the latest version 4.9.3.P but i’m still getting a blank screen. I can’t figure this one out guys. A little help please.

Joshua


Josh

  • Support Staff

July 21, 2016 at 3:03 pm

You could check your wp-config.php file. Near the bottom it should have this:

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
	define('ABSPATH', dirname(__FILE__) . '/');

If the above checks out, it may help to do a fresh install of Event Espresso 4 where you delete the event-espresso-core-reg folder from wp-content/plugins, then install a fresh copy that you download from your account page.


Joshua

July 21, 2016 at 3:46 pm

Hi Josh, I already tried that but again uploaded the latest version. Still the same error message. Renaming the dir ‘plugins’ does not help either. The wp-config file also looks good.


Josh

  • Support Staff

July 21, 2016 at 3:55 pm

If you’ve renamed the plugins dir then Event Espresso shouldn’t even be activated. If that’s the case then this may be an issue with your core WordPress installation. Have you tried uploading a fresh copy of WordPress?


Joshua

July 22, 2016 at 4:38 am

Josh,

I’ve reinstalled WordPress version 4.5.3 but still to no succes. Do you have any other suggestions? What i’ve so far tried.

  1. Updating EE4 to latest version
  2. Updating WordPress to 4.5.3 version
  3. Disabling plugins by renaming plugins folder
  4. Enabled debug mode through wp-config.php (no errors)
  5. Looked through server error logs (no errors)

Hope that you can think of something.

P.s. my hoster is also looking for a fix but can see any problemen occurring on the server.


Tony

  • Support Staff

July 22, 2016 at 5:24 am

As you’ve disabled all plugins on the site either there either a problem with the theme or one of your WP core files (also note its possible the site/sever has been compromised).

Are you using the default theme or your own?

Is this a single site install or multi site?

You can’t access the admin at all and whichever url you navigate to shows ‘No direct script access allowed’, correct?

Check the .htaccess and index.php file within your root directory.

Your .htaccess file should have something like the first example shown here:

https://codex.wordpress.org/htaccess
(although not always, you may have additional rules. But you’ll need to take a look and for anything that looks suspicious)

Your index.php file should have something very similar to this: http://take.ms/mgApc

That’s from one of my test sites, you may have a different path in the require() call but not much else.


Joshua

July 22, 2016 at 5:34 am

Hi Tony,

The problem is in the theme. Because after uploaden twentysixteen and renaming my theme i could log in an activate WordPress default theme. That worked! Wat do I need to look for in the theme?

Joshua


Tony

  • Support Staff

July 22, 2016 at 5:45 am

What theme are you using?

If your using a theme you have purchased I’d start by updating to the latest version.

We can’t provide support for any themes we have not built (we simply don’t know anything about the code used), you’ll need to contact the support team for the theme you are using and see if they have a solution.


Joshua

July 22, 2016 at 6:18 am

I found the culprit. In my theme i’ve got a folder /includes/ee4/

There I have a file called widgets.php. This file contains the following code.

https://gist.github.com/lorenzocaum/08f0629426cace30f652d313b7beedf8


Tony

  • Support Staff

July 22, 2016 at 6:27 am

Why do you have a copy of the EEW_Upcoming_Events.widget.php file within your theme?

Because of the first line in that file if you call the file directly it will throw the above error.

if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');

However you should not have a copy of that file within your theme, are you trying to create a custom widget?


Joshua

July 22, 2016 at 6:40 am

This had to do with a customization of some output in the theme. It’s been a while since but I got this through the Event Espresso form.

I’ll delete the file so problem solved. Thanks!


Tony

  • Support Staff

July 22, 2016 at 6:50 am

It is possible to create custom widets based on the default one from EE, then you can use that widget in place of the original within the widgets section.

Here is an example of create a custom widget:

https://gist.github.com/Pebblo/d0d5f485ae0599e56e20

That’s the widget within a Custom Functions Plugin, you can alter the output of the widget within that, install the plugin and add the ‘Custom Event Espresso Upcoming Events’ widget in pace of the other.


Joshua

July 25, 2016 at 9:48 am

Thanks Tony. I’ve managed to resolve this problem!


Tony

  • Support Staff

July 25, 2016 at 9:50 am

Great 🙂

If you run into any further problems please let us know.

The support post ‘No direct script access allowed theme error’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso