Home › Toolset Professional Support › [Closed] Error while adding relationship of types created in or before 2018
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 |
---|---|---|---|---|---|---|
- | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | - |
- | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | - |
Supporter timezone: Europe/London (GMT+00:00)
Tagged: Setting up post relationship, Types plugin
Related documentation:
This topic contains 12 replies, has 2 voices.
Last updated by Nigel 4 years, 6 months ago.
Assisted by: Nigel.
We are trying to add a new product and while adding a relationship of an event (section Event Product) "Mass Innovation Nights 90" or any other event that is created in or before 2018 is giving error "There has been an error, please try again later." Images 1.png and 2.png are attached for reference.
New events like "Mass Innovation Nights 129" are not giving any error while being added in the product entry for Event
Existing products also showing error for section relationship "Expert" onwards. Image 3.png attached for reference.
The same issue is faced while creating an event and adding venue relations. Venues that are created in or before 2018 are giving error "There has been an error, please try again later."
Similar error while adding event "Mass Innovation Nights 86 – Innovation for Everyone" on new product.
Website - hidden link
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Hi there
It sounds like you have a site that was created with Types 2 using the old system for relationships, and the errors you see arise from using with the current version of Types 3 possibly without having run the migration wizard to convert to the new relationships system.
If you go to Toolset > Relationships are you invited to run the migration wizard?
No, I am not getting that option. I have attached screenshot on Toolset > Relationships
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
I'm going to need to dive into the database to try and understand what's going on, so I'll need a copy of your site.
I will mark your next reply as private so that I can get log-in credentials from you—you may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site.
Can you tell me a little about the history of the site?
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
OK, I've downloaded a copy of your site, I'll install it locally and look into those errors.
I'll let you know what I find.
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
There's clearly something gone very wrong with the data on this site for the relationships, if you go to Toolset > Post types and edit the Events post type you will see at the bottom of the screen that the post type is seemingly part of 36 relationships, mostly seemingly duplicates of the same relationship.
It appears that the site and its relationships were seemingly created with Types 2 using the older relationship method, and has subsequently been migrated to Types 3 and the newer relationship mechanisms, but something has gone badly wrong with that migration.
I can see all those duplicates in the database, and I can't say right now whether it will be possible to "fix", I'm going to need to consult with the developers.
Before I need to do I need to know whether you have a backup of how the site was before any migration, i.e. when you were still using Types 2.
If no such backup is available we'll need to fix how the relationships are set up so that you can create new content and connect posts and it work as expected, but in that scenario it may be that older content loses their associations and would need to be reconnected.
To be able to start working on that, we'd need you to confirm exactly what relationships you should have been what post types. Please list the relationships and their type (e.g. a many-to-many relationship between experts and events, and whether or not this requires an intermediate post type to be able to store custom fields per association).
The more information you can give about how the site was set up initially, and when and how it was migrated, the more likely it is we will be able to recover the data.
Please do not make any changes until I confirm. I will update you more details in a while
Thanks for the details, Nigel.
The project was migrated from Drupal to WP a year ago. Each event can have products, experts, and voting associated with it.
Could you please let me know what is the procedure for migration from Drupal to WP. And in this case, we have both new and old data then what structural changes we need to make to remove these errors
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
However the migration was done it has filled up the table that stores information about Toolset post relationships with faulty data.
If you are able to rewind a year and redo the migration then it may be possible to perform the migration successfully and then proceed.
There is a guide to migrating from Drupal to WordPress here that you may find helpful: https://toolset.com/documentation/programmer-reference/guide-drupal-developers-switching-wordpress/
There is also a premium 3rd party plugin for converting from Drupal to WordPress which includes support for post relationships, available here: hidden link
If you've been adding content since the migration and it is not possible to go back then you will need to run a script to clean up the relationship tables and you'll need to recreate the correct relationships in the admin backend and then reconnect the posts themselves.
I can help with cleaning up the relationship tables if that is how you plan to proceed, let me know.
Thanks, Nigel. Please do provide me with the script that I need to run to clean the relationship table.
I will need to test it on my end.
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
OK, before proceeding make sure you have a current backup of the site.
Then go to Toolset > Settings > Custom Code where you can add a code snippet with the code below. This code only needs to be run once, so don't activate the snippet. Save it and close, and then use the "Run now" link. Afterwards you'll be able to delete it.
Note that this will clear the database tables concerning your post relationships. You will then have no relationships registered, and no data connecting events to other posts. You will need to reconnect the data once you have created the required relationships (at Toolset > Relationships).
The code is:
global $wpdb; $wpdb->query( "DELETE FROM `wp_toolset_type_sets` WHERE 1=1" ); $wpdb->query( "DELETE FROM `wp_toolset_relationships` WHERE 1=1" ); $wpdb->query( "DELETE FROM `wp_toolset_associations` WHERE 1=1" );
Let me know if you run into any problems running that code.
Thanks, Nigel, I will update you.
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Sure, let me just mark this as awaiting your reply so that it's not sitting in my queue.
The topic ‘[Closed] Error while adding relationship of types created in or before 2018’ is closed to new replies.