Skip Navigation

[Resolved] Issues after DB upgrade while updating Toolset Type plugin from 3.3.7 to 3.4.17

This support ticket is created 2 years, 7 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 25 replies, has 3 voices.

Last updated by Minesh 2 years, 5 months ago.

Assisted by: Minesh.

Author
Posts
#2537799

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Yes - that would be fine. That will allow me to check with minimum installation.

Please send me duplicator copy of your site.

More info:
- https://toolset.com/faq/provide-supporters-copy-site/

I have set the next reply to private which means only you and I have access to it.

#2541369

Hey Minesh. I will provide you the backup copy tomorrow.

#2541685

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

ok - fine.

I have set the next reply to private which means only you and I have access to it.

#2544923

Minesh there are some issues while creating Duplicator backup, I do have a LocalWP full site backup. Will that work for you?

EDIT
This message was not showing as private, so I removed the file link.

#2545703

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I'm able to deploy the duplicator of the site on my local test server. I can see with the duplicator you shared it is using the Toolset Types plugin version 3.3.7.

The Types plugin version 3.3.7 is after new post relationship is implemented.

I would like to know that:
- Are you trying to update the Types plugin from 3.3.7 to 3.4.17 and you are facing the issues?
- What exact steps I should follow to see the issue?
- Do I require SQL file that holds the old post relationship (pre Types 3.0.x) ? If yes, where can I get that SQL file that holds old post relationship?

#2548675

- Are you trying to update the Types plugin from 3.3.7 to 3.4.17 and you are facing the issues?
Yes exactly, once the plugin is updated and I run the Database migration suggested in plugin, I face the issues.

- What exact steps I should follow to see the issue?
Update the plugin
Migrate the database.
Search for an author name in site search, you will notice that search results do not contain posts of that author.

- Do I require SQL file that holds the old post relationship (pre Types 3.0.x) ? If yes, where can I get that SQL file that holds old post relationship?
Nope I don't think so, as the plugin version 3.3.7 is working fine for me, it's only after the update and migration the issue occurs.

#2554739

Minesh any update about this?

#2555001

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

After debugging too much I found the cause of the issue.

The issue was from the custom code you added to your child theme's search.php file where you are trying to fetch the related child post IDs. You should always use the Toolset post relationship API to fetch the related posts using the specified functions.

In this case I've used the function toolset_get_related_posts():
=> https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_posts

The custom code you added to your child theme's search.php file was here:

                 global $wpdb;
        		$author_posts = $wpdb->get_results( 
                    $wpdb->prepare( "SELECT child_id FROM {$wpdb->prefix}toolset_associations WHERE parent_id=%d", $authorID ) 
				);
				
				
				$posts_in = array();
				foreach( $author_posts as $ap ) {
					$posts_in[] = intval( $ap->child_id );
				}

- currently I've commented the above code with your theme's search.php file

I've replaced the above code with the following code with your search.php file available with your child theme:
=> themes/generatepress_child/search.php

$author_posts = toolset_get_related_posts(
					$authorID, //Post to query by.
					'article-authors',  //Slug of the relationship to query by
					'parent', //Name of the element role to query by.
					999, //Maximum number of returned results
					0, //Result offset
					array( //Additional query arguments
					),
					'post_id', //Determines return type
					'child', // which posts from the relationship should be returned
				
				);
				
				$posts_in = array();
				foreach( $author_posts as $ap ) {
					$posts_in[] = intval( $ap);
				}
		

Now we can see the correct results:
=> hidden link

Can you please confirm it works as expected now.

#2557773

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please confirm that the solution I shared above help you to resolve your issue.

#2558737

Thank you Minesh, It seems that the issue is fixed. I am still testing the complete website for any remaining issues. Will update here in a day or two.

#2559179

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Glad to know that the solution I shared help you to resolve the issue. Yes, you can test it and feel free to mark this ticket resolved.