Skip Navigation

[Resolved] WordPress database error in Toolset’s Dashboard

This thread is resolved. Here is a description of the problem and solution.

Problem: Several database errors are shown on the Toolset Dashboard when The Events Calendar plugin is active.

Solution: The next version of The Events Calendar should contain a permanent fix for this issue.

This support ticket is created 4 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 14 replies, has 2 voices.

Last updated by Christian Cox 4 years, 4 months ago.

Assisted by: Christian Cox.

Author
Posts
#1722143

I am getting ready to create the first Custom Template on our new test-development site, hidden link — using Toolset.

But when I went to Toolset, I looked at “Toolset > Dashboard” (it has its own dashboard) and saw the error message below, repeated 3 times. (There is no similar error on our existing Manhattan Bride site.) It looks like the error was going to keep repeating, but on the 4th time it was cut off.

Since it is called a “WordPress Database Error” I went to “”Database” on the new site’s dashboard and saw 95 tables — but none of them seem to have “Events” in the title. So I went to “Events” in the dashboard (we have the plugin “The Events Calendar”). But no events have been added.

There is a “Database > Repair DB” option — but I did NOT try that.

I obviously am hesitant to proceed with creating the new Custom Template until I can understand this.

Why am I getting this error and how can it be fixed? Thank you!

WordPress database error: [Unknown column 'EventStartDate' in 'order clause']
SELECT SQL_CALC_FOUND_ROWS DISTINCT wpq9_posts.ID FROM wpq9_posts LEFT JOIN wpq9_postmeta as tribe_event_end_date ON ( wpq9_posts.ID = tribe_event_end_date.post_id AND tribe_event_end_date.meta_key = '_EventEndDate' ) WHERE 1=1 AND wpq9_posts.post_type = 'tribe_events' AND (wpq9_posts.post_status = 'publish' OR wpq9_posts.post_status = 'tribe-ea-success' OR wpq9_posts.post_status = 'tribe-ea-failed' OR wpq9_posts.post_status = 'tribe-ea-schedule' OR wpq9_posts.post_status = 'tribe-ea-pending' OR wpq9_posts.post_status = 'tribe-ea-draft' OR wpq9_posts.post_status = 'future' OR wpq9_posts.post_status = 'draft' OR wpq9_posts.post_status = 'pending' OR wpq9_posts.post_status = 'private') ORDER BY EventStartDate DESC, wpq9_posts.post_date DESC LIMIT 0, 1

#1722147

I still need assistance. Please read the above.

#1722197

Hello, I've seen similar error messages in the past in a couple of tickets. One involved a plugin that was causing a conflict, and the other was related to some existing Views which were set up to display Events from The Event Calendar, and ordering or filtering in the View was based on a custom field called "Event Start Date" from The Event Calendar:
https://toolset.com/forums/topic/view-sometimes-no-returning-any-results/
https://toolset.com/forums/topic/view-does-not-show-events-from-tribe-events-calendar-plugin/

Just to clarify, The Events Calendar creates Events as posts in the standard post table, and their custom fields like Event Start Date are stored in postmeta as standard custom fields, if I recall correctly based on previous work. So you won't find Events in a custom database table, they are in the posts table.

The error you shared is triggered by a query looking for Events, and sorting those events by the Event Start Date field. I don't think it's closely related to Content Templates, so that wouldn't worry me. You mentioned this is a new development site, so these questions came to mind:
- Are all the Toolset plugins up-to-date, or did you copy plugins over from another site that might have been outdated?
- Did you create any Views yet, or import any Views from an existing site? If so, are any of the Views configured to display Events? Are any configured to sort or filter based on the Event Start Date field?
- Are you using a custom theme with custom code from another site in your functions.php file? If so, does the error go away when you activate a default theme like Twenty Twenty?
- Is there any custom code active in Toolset > Settings > Custom Code? If so, does the error go away when you set those snippets as inactive?
- If you create and publish one test Event with the event start date and event end date set in the Event editor page, does the error go away?

#1724515

Yes, we still need help. We tried each of the 5 solutions you proposed. None of them eliminated the error message. What else can we do?

#1725121

I will take a closer look if you provide login credentials in the private reply fields here. Let me know if it is okay for me to create a site clone using the Duplicator plugin.

#1725187

I ran some tests locally, and I was able to reproduce this error on a clean site with only Types, Blocks, and The Events Calendar plugins active before creating any site content. Let me escalate this issue to my 2nd tier support team. In a recent release of our software or theirs, something was introduced that caused this error to be thrown. I'll let you know what I find out. Thanks for the report!

#1725189

Thanks so much!! I look forward to hearing how this can be fixed!

#1727173

Okay I have some feedback from my 2nd tier support team. It turns out The Events Calendar intercepts all queries for the Events post type and adds in some additional query parameters. That is causing the query to fail with an error here in the dashboard. However, the error is only effecting display-related queries on this page, so that should limit the scope of the problem. It should not interfere with Content Template design or assignment. As a temporary workaround, they have provided a patch file. The Events Calendar provides a query parameter we can add to any query to prevent the additional query parameter manipulation causing this error, so we have added that filter suppression query parameter to the queries that trigger these errors on the dashboard. This is a temporary workaround. Until our developers work out a more permanent solution, the changes included in this file must be applied to new versions of the software that are released in the meantime. I'll keep you posted on that here with updates about the progress of work, and if new versions are released before the permanent solution I can provide assistance applying these changes in the new version of Types.

For now, you can find the patch file available here: https://drive.google.com/drive/folders/1Ljp-DN7JTrhWYXh5EdVDAcLC_xTq9OeQ?usp=sharing
Please download the zip, extract the contents, and replace the PHP file on your server at /wp-content/plugins/types/application/models/helper/placeholder.php

Let me know if you have questions about this, and I'll keep you posted here.

#1727243

Thank you for getting back to me and for sending the patch for our test-develoment site.

I have not touched our test site for days -- but now the home page on this test site is not working. It looks like the Header Top Content was modified and now does not read properly. Maybe other items were modified too.

Did you make any such changes on the site before cloning it? Please let me know. Here is the link to the homepage, so you can see the problem: hidden link

#1727265

Please IGNORE my last question -- "Reply # 1727243 -- we just had to get back to the correct "THE ISSUE 08" theme. (For some reason our theme was set on the Twenty Twenty theme.)

So we are OK now. Thanks!

#1727653
Toolset Dashboard Error Still 8-4-20.png
File replaced.png

The error is still there in Toolset > Dashboard. Attached are screenshots of the still-present error and the file that was replaced.

#1728503

Interesting, the problem was solved in my own local site when I added the patch, so something else is going on. I was able to make a clone of your site using Duplicator and run a few additional tests. I can see that there seems to be something going on specific to The Issue theme. If I activate Twenty Twenty instead, the message is resolved in the Toolset Dashboard. Let me pass that information along to my second tier team so they can examine the issue with the same theme active, please stand by and I will give you an update.

#1729543

Okay my team leader has provided another patch file for you to implement:
hidden link

Please download the archive and extract the file to /wp-content/plugins/types/application/models/helper/condition/type/fields_assigned.php

This resolves the problem in my local clone of your site. Please apply the patch and let me know if the problem is not resolved so I can take another look.

For future reference, we have added an erratum post about the issue with the patches available here: https://toolset.com/errata/the-events-calendar-triggers-database-errors-on-toolset-dashboard/

#1730001

My issue is resolved now. Thank you!

#1743165

Hi, I have another update for you. We've been testing with a preview of an upcoming release from The Events Calendar, and the problem seems to be resolved without the need for patches: https://github.com/moderntribe/the-events-calendar/tree/release/B20.08

Feel free to continue using the patched files until the next release of The Events Calendar, at which time the patched Toolset files will no longer be required. I'll let you know if I receive any more updates on the issue, but I suspect the issue will be obsolete with the next release of TEC.