Skip Navigation

[Résolu] Help me update my website to latest versions of Toolset plugins.

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem: I would like to update my website to use the new post relationships features, but I'm seeing some error messages and my Forms stopped working as expected.

Solution: Turning off AJAX submission seems to have resolved the Forms submission issues.

You can inspect each post relationship migration message for additional information about what's happening. In this case, it appears that the messages do not indicate any serious problems. The logs are quite detailed for debugging purposes, but these messages all seem to indicate posts that were deleted or old relationships that do not need to be migrated.

This support ticket is created Il y a 6 années et 5 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

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)

Ce sujet contient 9 réponses, a 3 voix.

Dernière mise à jour par Christian Cox Il y a 6 années et 4 mois.

Assisté par: Christian Cox.

Auteur
Publications
#921724

Hi,

I have recently tried ot upgrade my website to Types v3 as well as the latest version of the other plugins, but I did not have much success.

First thing that broke was the front-end forms for adding content. I managed to partially fix them by recreating the forms from scratch, but they still have glitches (I need to press the Submit button twice)... I also have some new unexpected ";" error from the functions file which was introduced after the update.

I have set up a temporary dev. subdomain for my website where I am trying to do the update and this is the environment which I would like to share with the support here. In the process of update I also had some issues with not being able to connect to the validation server that checks for the license code.

Before we get into more details I would like to ask what would be the best practice here? Do you want me to give you access to the working copy of the website with old plugins so you can try to upgrade on your side or you prefer to jump into troubleshooting new problems one by one?

#921930

I see that we have at least 3 issues here.

Our process is always to handle one issue each Ticket in the support forum

Hence, we will handle here the issue with the Toolset Forms, which you need to submit twice, to have them submitting for real.

I cannot replicate such a scenario, this seems to be bound to some AJAX forms I guessed, but even there I can submit the forms fine.
Can you outline precisely how to set up the form so to have that issue appearing?
Then we can fix it.

If there are no clear steps, please add a copy of your (slimmed down, if possible) site, and explain where we can see that issue.
It is helpful if the copy is of a site where you already disabled other plugins, themes and custom code, so the issue is "narrowed down" to the actual problem form, page and post, nothing else if possible.

Then we can analyze this and eventually fix it.
Of course, we can as well work with larger or more complex copies of websites, in case you have no possibility to provide a slimmed version of it.
https://toolset.com/faq/provide-supporters-copy-site/

Related to the other 2 problems you report:

1. I also have some new unexpected ";" error from the functions file which was introduced after the update.

Toolset Updates do not modify the functions.php File of the theme, hence it cannot be that the issue is due to Toolset, but maybe I misunderstand you.
To handle this, please enable WP Debug and look what the error is (unexpected ; at line... or similar?)
Then head to the code line in question and correct that code if it's in your theme (would not be related to Toolset)
If the error points to a Toolset File let us know in a new ticket (I cannot split first replies, otherwise I would create one for you)

2. In the process of update I also had some issues with not being able to connect to the validation server that checks for the license code.

There are several known issues here.
First, Views will continue to tell you it's not registered even if it is.
Second, there may be some issues with the server (that was yesterday) that resulted in packages not found on download.
In any case Toolset works as well when you do not register it, but if you feel there is an issue not described above, please as well add a new ticket which we can handle

About access details, if you can give us the Duplicate, for the problems that require it, that would be great because debugging online is somewhat difficult (we cannot run debug tools remotely, and we need to see what happens in the code while performing the actions you describe)

Thanks!

#922027
Screen Shot 2018-07-07 at 13.19.08.png

Hi Beda,

Thank you for looking into this issue.

1. Regarding the form - yes you are right, this has to do with an AJAX submitted form, I solved this by simply turning off AJAX, so I count this solved now as I might return to this later if I want to use AJAX in the future.

2. The unexpected ";" error seems to have been triggered by the form itself as it has radio inputs and if I submit one of the inputs without a value it triggered the error, once I set up the form to operate properly the error disappeared. I will still need help making this validate properly as I have not found a way to make any of the three value fields be required, but this issue is not critical as of now so I will leave this for later too.

*To further understand the issue you can see this screen recording:
lien caché ..
First of all I would like to mention that this is the "Add new product" form where users can add products to their farms.
Here I have the "Опаковка:" Field (means package) and then I have three radio buttons with respecting inputs fields for each type of package:
- user must input kgs, if the package is "теглова" (or package by weight),
- or milliliters if the package is "обемна" (volumetric),
- or pcs, in the case where the package is "количествена" (quantitative).
My problem is that it must be mandatory for the user to select one of the radios AND input a value in the field so they can properly define what type of packaging their product has, but I have not been able to make this work. I have made the field required but it validates upon selecting the radios, not upon selecting the radio and giving a value to the field below. If the user selects the radio and does not input a value in the field the form is submitted and the ";" error is shown.
I use this to visualize a calculation of the product price: price per kig / price per liter / price per piece.

3. Regarding the validation of registration code - okay, count this solved then.

4. Since I have already made a lot of progress regarding the previous issues I would like to get some help on the following first:

Regarding the migration to the new post relationships methods.
When I run the migration wizard I get the following error: (screenshot attached)
When I try to click the link above the "Run the migration" button that reads:
"Please read our comprehensive guide to learn how to use Toolset to leverage the power behind post relationships." - the link is not active, I guess the guide is not ready yet?

So here is the code that triggers the warning:
(This code helps auto-assign the parent post relationship when submitting via front-end-form)

/* Autofill Product > Farm; Product > Workshop; Seed > Seed Bank relationships */

add_action('cred_save_data', 'my_first_save_data_action',10,2);
function my_first_save_data_action($post_id, $form_data){
 // if a specific form
 if ($form_data['id']==979) {
  $parent_id = url_to_postid($_SERVER['REQUEST_URI']);
  update_post_meta($post_id, '_wpcf_belongs_farms_id', $parent_id);
 }
}
add_action('cred_save_data', 'my_second_save_data_action',10,2);
function my_second_save_data_action($post_id, $form_data){
 // if a specific form
 if ($form_data['id']==298) {//change this accordingly
  $parent_id = url_to_postid($_SERVER['REQUEST_URI']);
  update_post_meta($post_id, '_wpcf_belongs_seed-bank_id', $parent_id);
  //also edit this, since it's another post type!
 }
}
add_action('cred_save_data', 'my_third_save_data_action',10,2);
function my_third_save_data_action($post_id, $form_data){
 // if a specific form
 if ($form_data['id']==979) {//change this accordingly
  $parent_id = url_to_postid($_SERVER['REQUEST_URI']);
  update_post_meta($post_id, '_wpcf_belongs_workshop_id', $parent_id);
  //also edit this, since it's another post type!
 }
}

This code came from another ticked where I asked for help and you did great helping me solve the issue:
https://toolset.com/forums/topic/auto-assigning-parent-post-via-cred-api/
Just it seems like now it needs an update too.

Thank you for taking the initiative to help me again!

#922178

Hi, this code should be fine. We built a backwards-compatibility layer so that the old parent / child relationship system will continue to function in the new system for old post relationships and old forms. That includes post relationship assignment in code. If you create new relationships and new forms, similar code will not be effective. Instead of update_post_meta you'll have to use the new Post Relationships API toolset_connect_posts.
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_connect_posts

Once you have migrated, please run some tests to confirm everything is still working as expected with these parent assignments, but based on what I'm seeing here everything looks fine as it is.

#922633

OKay I have run the migration and I got a whole lot of errors.

Here is my log: lien caché

I am not sure if these are real errors and if they affect something because things regarding relationships and posts seem to look okay and work okay - posts get assigned to their parents, I am not sure if I need to change something now?

However upon running the tests I have noticed some new malfunctions occurring.
First thing is that user registration form stopped redirected to my login page after submitting the form.
I will have to work and translate all my old CRED forms and generate them with the updated version of the plugin because other things stopped working as well (like image attachments).

These are issues that I will come back to after I have updated all old CRED code to the new one and if they persist I will ask for help.

One thing that bothers me and that is my next big question is that my website is based on the Toolset Starter Theme v1.4.2 (Toolset Starter Child v1.1) And I see that you have discontinued this theme and support for it. So my question - do I need to change my theme to ensure ongoing Toolset compatibility? Or I am good the way it is?
Also I keep getting this error in the console even on my live website which runs the setup prior to update (I have it on the updated version as well).
Неуспешно зареждане на <script> с адрес „lien caché.
(Unable to load <script> with address "....toolset-starter-child/js/custom-jq.js?ver=1" )
My starter theme doesn't even have this file and directory, do I need to create it manually?

Thanks!
Please feel free to answer my question regarding the theme support, I will give you a hint at what's next when I update my forms with new Toolset Forms code.

#923058

I am not sure if these are real errors and if they affect something because things regarding relationships and posts seem to look okay and work okay - posts get assigned to their parents, I am not sure if I need to change something now?
During migration, the system scans the postmeta table for old post relationship links using the "_wpcf_belongs_{parent-post-type-slug}_id" syntax. It tries to migrate each one of those to the new system. Some messages are expected, and can be safely ignored. The best way to determine that is to go line by line through the messages and figure out what's going on. Let's look at the first type of message:

Unable to migrate an association from post #810 to #812 to a relationship "farms_product": The element to connect with doesn't belong to the relationship definition provided.

Please check posts 810 and 812 in wp-admin or in the database, and determine the post type of each post. Then compare those post types with the relationship "farms_product". What can you tell based on these post IDs and the post relationship slug? Is either post ID deleted, or in a post type that is not part of this relationship?

The next type of message I see is like this:

Unable to migrate an association from post #209 to #220 to a relationship "parent_slug_product": Relationship definition "parent_slug_product" not found.

Again, check the post IDs and post types. My guess is that there was a post relationship established between these posts at some point using custom code, and that post relationship is no longer valid.

Finally I see some messages like this:

Unable to migrate an association from post #0 to #978 to a relationship "workshop_product": Unable to load posts 0 (0).

This indicates a relationship link existed at one time, but the parent post ID was removed or set to 0. The old post relationship was invalid, so it was not migrated to the new system.

Do I need to change my theme to ensure ongoing Toolset compatibility?
Please review this ticket for more information about Toolset Starter Theme support moving forward: https://toolset.com/forums/topic/toolset-starter-theme-discontinued-do-we-have-to-worry/
If you have additional questions, feel free to open a separate ticket. Our support policy is to address one main issue per ticket.

Unable to load <script> with address "....toolset-starter-child/js/custom-jq.js?ver=1"
Please create a new ticket so we can investigate this message in more detail. This file isn't part of the Toolset Starter Theme and shouldn't be enqueued by the theme. My guess is another plugin, custom code, or content added to your site is trying to load a JavaScript file incorrectly.

#923161

Okay I have understood some of the issues:

Unable to migrate an association from post #810 to #812 to a relationship "farms_product": The element to connect with doesn't belong to the relationship definition provided.

These kind of errors that speak about a relationship of farms_product come to products that are actually in a relationship with a Workshop.

and these:

Unable to migrate an association from post #68 to #987 to a relationship "workshop_product": The element to connect with doesn't belong to the relationship definition provided.

Come from products that are in a relationship with a Farm.

In my setup I have things as follows:
I have Product post types.
I have Farms post types.
I have Workshops post types.
Products are assigned as Child post types to the Farms, and are also assigned as Child post types to the Workshops.

The errors that contain #0 indeed were deleted posts.

What I have found out however is that in my live setup some of the products have lost their relationships to their parents. I have no idea how this happened since the setup was working fine. I had however recovered a Duplicator backup in a state of emergency some weeks ago and I think that this might have been caused it. I have no other explanation to this issue since I had situations where all products were added on the same date by their owner and only part of them lost their relationships.

Do you think that recovering a Duplicator backup can cause this?
Have in mind that I did not use Export/Import Types feature within Toolset setting page, I just did raw Duplicator backup/restore.

I will work on recreating the rest of the forms with the new code now.
Thank you for clarifying the situation with the migration log file.

#923644

What I have found out however is that in my live setup some of the products have lost their relationships to their parents.
You mean before migrating the production site, there are some missing relationships? If so, this is a separate issue and I'm not sure offhand if Duplicator could cause it. Please create a new ticket so we can investigate in more detail. If you're saying that posts in production have lost their relationships after migrating, but the relationships existed before migrating, then please provide the production migration log information.

#949365

I can not confirm if they existed before I restored the Duplicator backup but I assume they did since the setup has been working just fine. Obviously I need to spend more time testing this on the live site prior to running the migration.

As of now I am more keen on migrating the setup to the latest version of software and then trying to sort out bugs one by one rather than working on fixing bugs with the old versions...

#950377

Okay, please let me know if you need additional assistance here.