Posted: September 23, 2022 at 7:12 am
|
Hello, We use EE with many of its add-ons, specifically the WP Users add-on as well. All the EE plugins are at the latest version and the PHP version in our prod is 7.4. Whenever we try to revert a Published Event back to Draft status, the page throws the following error: PHP Fatal error: Uncaught TypeError: Argument 1 passed to EED_WP_Users_Admin::save_wp_user_event_setting() must be an instance of EE_Event, null given, called in /webroot/www/html/wp-content/plugins/event-espresso-core-reg/admin_pages/events/Events_Admin_Page.core.php on line 1054 and defined in /webroot/www/html/wp-content/plugins/eea-wp-user-integration/EED_WP_Users_Admin.module.php:931 Any help regarding this error, would be greatly appreciated. Specially if this error is specific to our environment. |
Hi there, So, this is a strange error for a couple of reasons. We hook into the WP core save_post, doa bunch of checks and additional processing, then call an EE Admin page method _insert_update_cpt_item() Which again does some additional checks and then calls any callback functions we want to run to update various sections. The fact that you are getting the above error means all of the additional processing worked as expected, and apparently the ‘default’ callbacks all worked but the callback for the WP user integration add-on did not have a valid event passed to it. Now, it works as expected when I test this (on multiple PHP versions) which is why this is odd. We filter the above callbacks using:
So my first question is, do you have any custom code hooking into the above? If I recall correctly from previous threads, either you or someone on your team is comfortable with PHP, correct? |
|
|
Thank you for the initial explanation Tony. Yes we do have a full-stack developer who works with PHP, we are not using the hook you mentioned anywhere. These are the hooks we have customized around: AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful Is it possible that this error is due to a faulty or missing value in the Database? And if so, would removing and reinstalling the WP Users help? |
I don’t think any customization on those hooks would cause this.
Possibly, but it seems unlikely in this case.
Not with this specific issue, no. Is this event published publicly or private? |
|
|
September 29, 2022 at 12:05 pm The problem is occurring with Published Events. And it’s not just one event, but all of the published events bring up this error. |
September 29, 2022 at 12:53 pm Are the events published privately or public? In the ‘Update Event’ meta box, does it show ‘Privately Published’? |
|
|
September 30, 2022 at 11:24 am No, they are all public. |
|
This reply has been marked as private. |
My apologies, I should have kept you in the loop here. I’ve tried everything I can to reproduce this but I’m always getting a valid event from the above code. I’ve asked our senior developer to see if he can see any reason for this. Can we add some additional code to the site to debug the above values/queries and see if anything stands out? |
|
|
Sure Tony, let us know what needs to be added. We’ll run the tests and let you know the outcome. |
Right above the first line of code you posted above, add this:
That will output the SQL query used by the event model. You may need to add Can you paste the query here, please? |
|
|
This reply has been marked as private. |
Ok, so that Event ID is indeed 7897, correct? The event has NOT been trashed, correct? With a prefix of (Apologies for the basic questions but I still can’t reproduce so working through everything I can think of currently) Can you run SQL queries directly? Using CLI or something like PHPMyAdmin on that database and see if an event is returned when that query is run? |
|
|
Yes the Event ID is 7897, yes it is a live event. Let me see what I can do about direct querying. |
Actually, another test here. Have you output Add |
|
|
Yes I have already tried that. It brings up nothing. The $event variable is empty. |
Hmmm, so either the query fails completely or somehow the model is returning a cached value although I can’t see anywhere to cache… and I would then expect to be able to reproduce. Any luck running the above query directly? |
|
|
Yes, we ran the query directly. Not just with the event ID mentioned in the above reply, but with all the event IDs which are published. Got the relevant event back as a result each time. An update on my investigation though: The above behavior is consistent across all the browsers, and happens each time the same way. |
|
This reply has been marked as private. |
Hi there, I’ve literally tried every possible combination I can think of to try and reproduce this. I’ve used Chrome, FireFox, Brave and IE to run the same tests, clear cache and all data (in all browsers except Chrome) and run through the same tests you mentioned. However, I still don’t get a fatal error here. I’ve also asked another member of the team to test the same steps on a couple of their test sites and again no issues. I can’t think of any reason why a clear session would cause no EE_Event to be returned above and I’ve asked our senior developer for anything they can think of, he’s just as baffled as me as to why a clean session would cause this (he also tried do to reproduce but again can’t). As you are the only user reporting this and none of us can reproduce on various different servers (we all have our own different testing environments and some shared) it points to ‘something’ specific to your site/setup however I can’t even take a guess as to what that would be currently. Unfortunately, I’m lost with this one, the session state should matter and without being able to reproduce somewhere it’s really difficult to troubleshoot. |
|
The support post ‘Fatal Error when Updating a Published Event back to Draft’ 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.