Support

Home Forums Event Espresso Premium EE causing "Undefined constant" error with Thank You templates path

EE causing "Undefined constant" error with Thank You templates path

Posted: May 19, 2024 at 7:48 pm


OVIC

May 19, 2024 at 7:48 pm

Hello there,

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)

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

Things I have tried in order to troubleshoot

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”


Rio

  • Support Staff

May 19, 2024 at 8:48 pm

Hello,

Since you did disable all plugin, i’m wondering if there’s any chance you added any Customize Code in your Child Theme?

Have you tried changing theme and just to check?

You can use https://wordpress.org/plugins/health-check/ or any similar plugin.

You can do the above using Troubleshooting mode:

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.

thanks


OVIC

May 19, 2024 at 10:28 pm

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


Rio

  • Support Staff

May 19, 2024 at 11:37 pm

So its probably a custom code added in your theme. Do you remember those codes you have? anything particular for Customizing thank you page?

you can check what is your error log.
themes/ovic/functions.php:500

you can also fill this form, https://eventespresso.com/send-login-details/

we will be needing your FTP credentials too.

thanks


Tony

  • Support Staff

May 21, 2024 at 2:08 pm

Hi there,

This error:

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?

Post it to PasteBin and then add the link here.


OVIC

May 28, 2024 at 6:06 pm

Thank you Rio and Tony, I will grab that code! Watch this space!


Rio

  • Support Staff

May 28, 2024 at 6:42 pm

awesome. have a wonderful day!.

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.

Event Espresso