Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.
Problem:
The issue here is that the user is pulling the relationship data in their CRED hook but its not pulling the current set relationship but the previous one.
This support ticket is created vor 5 Jahren, 4 Monaten. 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.
Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.
I'm using a relationship in a Cred form and need to use a cred_save_data to modify some post parameters (including those related to the relationship).
I have tried a first submission and it seems that the cred_save_data is not able to retrieve the relationship info. Then I launch the form another time and the right relationship was recorded.
It seems that when you are defining the relationship in the form for the first time, the cred_save_data is not able to get the info?
Can you check and tell me if this is the case and how to use the relationship inside a Cred and get the right value the first time the form is submitted.
What part of the relationship info you are trying to get. Could you provide a little more details on what you are trying to do so that I can point you in the right direction?
I have defined a relationship between product and salle (salle can have several products).
I have a post form (modify) for stage in which I placed the relationship field.
Then, I have a snippet (cred_save_data) to built the created post title thanks to some info, including salle.
Here is the code :
During the first submission, instead of the salle value, I'm getting the post title of the current modify post. Then, if I launch a seconde submission, then the right relationship info is recorded.
Again, it seems like the relationship info was not available during the first submission !
I tried with your code and the result is the following :
- First submission : blank page
- Reload of the same page => this hook works
- But the title is not inline with the value of the relationship field
Then I used only the form 1027 (and placed directly cred_save_data_1027 and then :
- First submission : => this hook works
- But the title is still not in line with the relationship field !
So, the situation is always the following :
- when submitting the form, the relationship field is well saved
- the title is not updated with the last value of the relationship field
You have it in the backoffice/gestion-des-stages/
It is integrated inside a modal window.
Just click on "Modif" in the right of the first line (Stage du 2019-06-19 à Saint Quentin Fallavier). As it is a test post, you cna use it to make some tests.
Regards
Pat
Not sure to have been sufficiently clear. First, I made a mistake : this is not inside a modal window, but redirect to the product page for modification (produit/stage-du-2019-06-19-a-vaulx-en-velin-salle-1/?content-template-id=1030)
I just tried to modify a stage (page backoffice/gestion-des-stages/ and click on Modif in the right).
The initial title was : Stage du 2019-06-19 à Vaulx en Velin – Salle 1
Then, I change "Lieu du stage" from Vaulx en Velin – Salle 1 to Saint Quentin Fallavier and click on MODIF.
Nothing changed, I'm getting a page with : ID: 1040 post_title: Stage du 2019-06-19 à Vaulx en Velin – Salle 1post_name: stage-du-2019-06-19-à-vaulx-en-velin-–-salle-1post_author: 1
And nothing is changed in the post (relationship salle-product not updated and post title not updated neither !).