Posted: May 12, 2016 at 10:08 pm
A little less than a month ago, you guys helped me solve this issue: https://eventespresso.com/topic/calendar-database-mismatch/ I was attempting some custom work on the Events Check-In page in which the date of the Event would be listed in the dropdown menu. It was successful, however, recently, we migrated to a new server, and this code is no longer working. I’m wondering why it is no longer working, but really, I just need the code to work. The file is EE_Event_Registrations_list_Table.class.php in caffeinated/admin/extend/registrations Here is the error:
Any help would be greatly appreciated! |
|
Hi there, The error means you are calling a function on something other than an object. I’m guessing your using something like this:
and $datetime is not an object, maybe all datetimes have expired, it could be a few different thing but without seeing the code we can not provide any information. However, whilst we can provide examples like I did in your previous post we can not provide support for custom code or modifying code functions/files within Event Espresso. |
|
Hey Tony, I am just trying to call a feature that is already built in and you have already supplied some code that helped and worked. I have tried your other line of code listed, and it also brought up an error to a non-object:
There are always events every day, every week, every month, so what would change that could cause such an error? I tried updating EE4 to the latest version for security reasons and bug fixes to see if that would fix the error, but it still occurs. The code look like exactly how you provided it:
The line where $eventdate is erroring because of get_i18n_datetime. |
|
It wouldn’t hurt things if you add some sanity checks to your code e.g.
|
|
Hey Josh, Thank you for the sanity check. After I set $evtdatetime, I add that code and what it shows is that an echo test isn’t even being processed. |
|
You might look a bit upstream in your code to make sure you have an event object. |
|
No other code had been changed on this page which makes it hard to figure out if there is an event object somewhere else. I wonder why the switch to a new server brought up that error. If we go back to the original issue and try to grab it without the get_i18n_datetime() function, I am getting the UTC+0 DateTime from the database. However, in my attempt to try and convert it to -6 hours UTC, the dates still appear to be off by about 24 hours. So dates that should appear for 5/15 are appearing as 5/14. To try and find a workaround for the lack of the get_i18n_datetime code, I tried doing something like this:
get_event_date is a custom function that grabs the date using the Event ID directly from the database. And then echoing out the code:
Even with the offset code, it is showing wrong dates. |
|
This is randomly working again and I can’t even explain why, as the code is exactly as is, when Tony posted it, so there is no issues. I’ll set this to resolved in a few days if everything continues to work properly. |
|
The support post ‘get_i18n_datetime() on a non-object’ 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.