Support

Home Forums Event Espresso Premium EE Critical Error

EE Critical Error

Posted: October 4, 2020 at 5:33 pm


KGM_Adm

October 4, 2020 at 5:33 pm

Getting this critical error on my event page, not sure why:
https://pastebin.com/pbbpnJZW

Here is the code it’s referring to in content-espresso_events-shortcode.php
https://pastebin.com/SeC24NUm

Thanks in advance!


Tony

  • Support Staff

October 5, 2020 at 3:26 am

Hi there,

It means your $event variable doesn’t have an EE_Event and is null.

You’ll need to troubleshoot and see what the $post variable is on that loop to track down what is going on.

To prevent the error you can wrap lines 58 and 59 in something like:

if ( $event instanceof EE_Event ) {

}

Then see what ‘event’ has a missing description and work from there.


KGM_Adm

October 8, 2020 at 5:43 pm

Strange, I’ve put the if statement in on 58 and 59. All my events have descriptions. The part I find strange is that Im calling events through the [ESPRESSO_EVENTS] shortcode and it doesn’t seem to be updating?

What I mean by updating is that all my events have expired but they are still showing up through the short code, why is this happening?


Tony

  • Support Staff

October 9, 2020 at 3:32 am

Strange, I’ve put the if statement in on 58 and 59. All my events have descriptions.

Then just after the above if statement, add something like this:

if ( ! $event instanceof EE_Event ) {
    var_dump($post);
}

Will output all kinds of details for $post when $event is not an EE_Event, then you’ll know which post object is causing the above and you can go from there.

What I mean by updating is that all my events have expired but they are still showing up through the short code, why is this happening?

Do expired events show on your default /events/ output?

Or whatever you are using for the events slug in Event Espresso -> Events -> Templates -> Event List Pages -> Event Slug.

On the same setting page above, do you have the ‘Display Expired Events’ option set to Yes?


KGM_Adm

October 12, 2020 at 2:15 pm

then you’ll know which post object is causing the above and you can go from there.

They are displaying similar info, how will I know which is causing the error?

Do expired events show on your default /events/ output?

Yes they do

do you have the ‘Display Expired Events’ option set to Yes?

No, it is set to “No”


Tony

  • Support Staff

October 13, 2020 at 2:29 am

They are displaying similar info, how will I know which is causing the error?

If you added the code I gave you above to use var_dump() on the $post object when $event was not an EE_Event object it will give you all kinds of details for the specific $post object that is throwing the error.

Yes they do
No, it is set to “No”

Then you may have some additional code on your site that is changing the event query, where that is I have no idea. Have you added any custom snippets to your site? If so work through those and comment them out to see if they make a difference.

Which page do you have the shortcode on so I can take a look?


KGM_Adm

October 18, 2020 at 8:20 pm

If you added the code I gave you above to use var_dump() on the $post object when $event was not an EE_Event object it will give you all kinds of details for the specific $post object that is throwing the error.

So I added it but there was a lot of info shown, what should I be looking out for exactly? It all looks similar, nothing that stood out.

Which page do you have the shortcode on so I can take a look?

https://kidsgreatminds.org/courses

Then you may have some additional code on your site that is changing the event query, where that is I have no idea. Have you added any custom snippets to your site?

I am using FacetWP to filter the events which may be conflicting with the expired events? It was working fine right before the events expired so I am not too sure about the problem.


Tony

  • Support Staff

October 20, 2020 at 6:04 am

So I added it but there was a lot of info shown, what should I be looking out for exactly? It all looks similar, nothing that stood out.

The var_dump output will only happen for a post that isn’t returning an EE_Event for $event, so find out which specific event posts that is (check the ID) then compare that event with a working event and see what the difference is.

I am using FacetWP to filter the events which may be conflicting with the expired events? It was working fine right before the events expired so I am not too sure about the problem.

I don’t use FacetWP so I’m not sure, if you’d like to send a copy over I’ll install it on a test site and see if anything stands out.

I’m guessing its just pulling the events based on the event posts so then FaceWP doesn’t know about expired datetimes etc but I’m simply guessing right now.


KGM_Adm

November 2, 2020 at 4:08 pm

Well all my posts seem to be returning the var_dump…

Here is a link to FacetWP
https://drive.google.com/file/d/1Rdeir1Op_niMiKpVmT3cNsG4SNPiI3NR/view?usp=sharing

I believe it can differentiate between expired and active events as we have over 1000 events but it knew to only show the active ones at time of setup.


Tony

  • Support Staff

November 3, 2020 at 3:02 am

Well all my posts seem to be returning the var_dump…

Repost/update the content of your template file to Pastebin and link it here, please.

Here is a link to FacetWP

Requested access.


KGM_Adm

November 7, 2020 at 1:35 am

Requested access.

Granted, click the link again.

Repost/update the content of your template file to Pastebin and link it here, please.

https://pastebin.com/GKE1X0va


Tony

  • Support Staff

November 9, 2020 at 5:13 am

Ok, so what do I need in FaceWP to reproduce what you are doing?

I checked the code on a test site and it’s working as expected, no var_dump() is displayed when $event is not an EE_Event


KGM_Adm

November 10, 2020 at 12:36 am

In FacetWP I have 5 facets: https://imgur.com/a/AD8uGsv

Each facet is set up like this: https://imgur.com/a/RWkvvDt
Except for the search facet that is set up like this: https://imgur.com/a/uawSPjJ

Afterwards, you need to click reindex. Then I have a page set up with the facet shortcodes at the top and the event espresso shortcode under it.


Tony

  • Support Staff

January 7, 2021 at 6:53 am

My apologies, I missed this reply and the forum automatically closes threads with no activity. When looking at your new thread it reminded me of this post.

To fix this you need to change line 26 from this:

$event = EEH_Event_View::get_event();

To this:

$event = EEH_Event_View::get_event( $post->ID );

Which will force the function to return an EE_Event for the ID specified if one exists.

The support post ‘EE Critical 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