My organisation has been running Event Espresso for about 5 years successfully. We are currently updating our server’s operating system on a staging server and have come across an issue with Event Espresso.
On our staging server, everything is working as it should except for Event Espresso. When trying to get to any of Event Espresso’s pages, – settings, events etc, it throws a “There has been a critical error on this website. Please check your site admin email inbox for instructions.” error.
It turns out this is also an issue on our current production server, but appearing only as a warning.
The error seems to be centred around the thank you templates path (see full error log at the bottom of my post)
I have uninstalled and reinstalled EE – no change
I have disabled all plugins running only EE – no change
Can you please point me in a direction?
————-
Here is the full stack trace from ovic-prod if you need it:
[09-May-2024 18:00:38] WARNING: [pool ovicwww81] child 176309 said into stderr: “NOTICE: PHP message: PHP Fatal error: Uncaught Error: Undefined constant “ovic\theme\event_espresso\THANK_YOU_TEMPLATES_PATH” in /var/www/vhosts/ovicwww/releases/ovic20200707/wp-content/themes/ovic/functions.php:500″
[09-May-2024 18:00:38] WARNING: [pool ovicwww81] child 176309 said into stderr: “Stack trace:”
[09-May-2024 18:00:38] WARNING: [pool ovicwww81] child 176309 said into stderr: “#0 /var/www/vhosts/ovicwww/releases/ovic20200707/wp-includes/class-wp-hook.php(324): ovic\theme\event_espresso\{closure}()”
[09-May-2024 18:00:38] WARNING: [pool ovicwww81] child 176309 said into stderr: “#1 /var/www/vhosts/ovicwww/releases/ovic20200707/wp-includes/plugin.php(205): WP_Hook->apply_filters()”
[09-May-2024 18:00:38] WARNING: [pool ovicwww81] child 176309 said into stderr: “#2 /var/www/vhosts/ovicwww/releases/ovic20200707/wp-content/plugins/event-espresso-decaf/core/helpers/EEH_Template.helper.php(370): apply_filters()”
[09-May-2024 18:00:38] WARNING: [pool ovicwww81] child 176309 said into stderr: “#3 /var/www/vhosts/ovicwww/releases/ovic20200707/wp-content/plugins/event-espresso-decaf/core/admin/EE_Admin_Page.core.php(1261): EEH_Template::display_template()”
[09-May-2024 18:00:38] WARNING: [pool ovicwww81] child 176309 said into stderr: “#4 /var/www/vhosts/ovicwww/releases/ovic20200707/wp-content/plugins/event-espresso-decaf/core/admin/EE_Admin_Page.core.php(710): EE_Admin_Page->_add_help_tabs()”
[09-May-2024 18:00:38] WARNING: [pool ovicwww81] child 176309 said into stderr: “#5 /var/www/vhosts/ovicwww/releases/ovic20200707/wp-content/plugins/event-espresso-decaf/cor…”
[09-May-2024 18:01:15] WARNING: [pool ovicwww81] child 176341 said into stderr: “NOTICE: PHP message: PHP Fatal error: Uncaught Error: Undefined constant “ovic\theme\event_espresso\THANK_YOU_TEMPLATES_PATH” in /var/www/vhosts/ovicwww/releases/ovic20200707/wp-content/themes/ovic/functions.php:500″
[09-May-2024 18:01:15] WARNING: [pool ovicwww81] child 176341 said into stderr: “Stack trace:”
[09-May-2024 18:01:15] WARNING: [pool ovicwww81] child 176341 said into stderr: “#0 /var/www/vhosts/ovicwww/releases/ovic20200707/wp-includes/class-wp-hook.php(324): ovic\theme\event_espresso\{closure}()”
[09-May-2024 18:01:15] WARNING: [pool ovicwww81] child 176341 said into stderr: “#1 /var/www/vhosts/ovicwww/releases/ovic20200707/wp-includes/plugin.php(205): WP_Hook->apply_filters()”
[09-May-2024 18:01:15] WARNING: [pool ovicwww81] child 176341 said into stderr: “#2 /var/www/vhosts/ovicwww/releases/ovic20200707/wp-content/plugins/event-espresso-decaf/core/helpers/EEH_Template.helper.php(370): apply_filters()”
[09-May-2024 18:01:15] WARNING: [pool ovicwww81] child 176341 said into stderr: “#3 /var/www/vhosts/ovicwww/releases/ovic20200707/wp-content/plugins/event-espresso-decaf/core/admin/EE_Admin_Page.core.php(1261): EEH_Template::display_template()”
[09-May-2024 18:01:15] WARNING: [pool ovicwww81] child 176341 said into stderr: “#4 /var/www/vhosts/ovicwww/releases/ovic20200707/wp-content/plugins/event-espresso-decaf/core/admin/EE_Admin_Page.core.php(710): EE_Admin_Page->_add_help_tabs()”
[09-May-2024 18:01:15] WARNING: [pool ovicwww81] child 176341 said into stderr: “#5 /var/www/vhosts/ovicwww/releases/ovic20200707/wp-content/plugins/event-espresso-decaf/cor…”
[10-May-2024 11:00:42] WARNING: [pool ovicwww81] child 179631 said into stderr: “NOTICE: PHP message: PHP Warning: Attempt to read property “ID” on null in /var/www/vhosts/ovicwww/releases/ovic20200707/wp-content/themes/ovic/functions.php on line 333″
Current system
I had a look back on the current system which is running the older php 7.4 to see what it has;
[10-May-2024 10:47:46] WARNING: [pool ovicwww74] child 12773 said into stderr: “NOTICE: PHP message: PHP Warning: addcslashes() expects parameter 1 to be string, array given in /var/www/vhosts/ovicwww/releases/ovic20200707/wp-includes/class-wpdb.php on line 1785”
[10-May-2024 10:48:45] WARNING: [pool ovicwww74] child 12773 said into stderr: “NOTICE: PHP message: PHP Warning: Use of undefined constant THANK_YOU_TEMPLATES_PATH – assumed ‘THANK_YOU_TEMPLATES_PATH’ (this will throw an Error in a future version of PHP) in /var/www/vhosts/ovicwww/releases/ovic20200707/wp-content/themes/ovic/functions.php on line 500”
[10-May-2024 10:48:45] WARNING: [pool ovicwww74] child 12773 said into stderr: “NOTICE: PHP message: PHP Warning: Use of undefined constant THANK_YOU_TEMPLATES_PATH – assumed ‘THANK_YOU_TEMPLATES_PATH’ (this will throw an Error in a future version of PHP) in /var/www/vhosts/ovicwww/releases/ovic20200707/wp-content/themes/ovic/functions.php on line 503”
[10-May-2024 10:48:45] WARNING: [pool ovicwww74] child 12773 said into stderr: “NOTICE: PHP message: PHP Warning: Use of undefined constant THANK_YOU_TEMPLATES_PATH – assumed ‘THANK_YOU_TEMPLATES_PATH’ (this will throw an Error in a future version of PHP) in /var/www/vhosts/ovicwww/releases/ovic20200707/wp-content/themes/ovic/functions.php on line 509”
[10-May-2024 10:48:50] WARNING: [pool ovicwww74] child 12772 said into stderr: “NOTICE: PHP message: PHP Warning: addcslashes() expects parameter 1 to be string, array given in /var/www/vhosts/ovicwww/releases/ovic20200707/wp-includes/class-wpdb.php on line 1785″
Note that same error is there but its only a warning in php 7.4;
PHP Warning: Use of undefined constant THANK_YOU_TEMPLATES_PATH – assumed ‘THANK_YOU_TEMPLATES_PATH’ (this will throw an Error in a future version of PHP) in /var/www/vhosts/ovicwww/releases/ovic20200707/wp-content/themes/ovic/functions.php on line 503”
Tools -> Site Health -> Troubleshooting -> Enabled Troubleshooting mode.
That will disable all plugins and switch to a default theme and then allow you to enable specific plugins troubleshooting mode. Once disabled you will revert back to the current state.
Hi Rio, thanks for getting back to me. You’re onto something. I switched themes and EE started working, when I switch our theme back on it throws the error again.
Where should I be looking to find the conflict?
Cheers,
Dean
PHP Warning: Use of undefined constant THANK_YOU_TEMPLATES_PATH – assumed ‘THANK_YOU_TEMPLATES_PATH’ (this will throw an Error in a future version of PHP) in /var/www/vhosts/ovicwww/releases/ovic20200707/wp-content/themes/ovic/functions.php on line 503”
Highlights the issue here. this isn’t so much of an EE issue but a PHP8 issue with custom code within your theme.
Looking at the error, I’m guessing there is a function hooking in to add a custom template directory to search within the theme, but the constant its using hasn’t been defined correctly.
Can you post the contents for the themes functions.php file so we can take a look?
The support post ‘EE causing "Undefined constant" error with Thank You templates path’ 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.
Support forum for Event Espresso 3 and Event Espresso 4.