This thread is resolved. Here is a description of the problem and solution.
Problem:
The issue here is that the user wanted to set the parent post automatically when creating a chid post. Now the user will CREATE that parent post and when creating the child that parent should be set automatically.
Then on your CRED form where it has the Parent Field on the edit form page add this as the value [user_post_id author_id="[wpv-current-user info='id']" cpt='post']
This support ticket is created 6 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.
I am aware that you can create a new child Pet directly from the back end parent User Will page and that you can also select which User Will is the parent from the back end child Pet page.... But...
What I am trying to do is create a new child Pet using a CRED form on the front end. When I create a new Pet it doesn't add the Parent relationship.
If your child cred form doesn't already have this field on then you can add it by editing your form and then click on the Add Post Fields button and then adding the field for the parent.
Thank you for your response. I was aware that you could do it like this however this way means the user has to manually select the parent User Will in the form.
What I want to happen is for the child Pet to automatically make the parent-child connection. A User only has one User Will so I would need to pass to the form the ID of the users first and only User Will.
This can be done if you add the Child Post link to the parent post.
How this works is that if a user visits the parent post they can click on a link to create the child post and then this child will automatically have that parent post as their parent.
Thanks for your reply. My user does not start on the Parent page sadly so when they click on the 'add new child Pet" I need some hidden code in the form to find the Parent User Will of the logged in user and add it to the form to make the connection.
The User only has one Parent User Will CPT so the child PET CPT needs to find the parent ID from the current user logged in...
Also I notice that in my version of Toolset I have no Relationship selection in the admin area(I have attached a screenshot from one of your tutorial videos) Is this a feature that has been removed?
Also my question is that If the user will be the one to create the parent ? Will the user only be allowed to create one parent ? Once we know how to get the Parent based on that current user then we can have it automatically add the parent.
The user initially creates the User Will by a CRED form however I'm still trying to find a way to only create one User Will as if the user goes back to that page it creates a new one... Then the user navigates to a new page where they select to create a new Pet which they can do several times. In the end a new page shows the User Will and then the list of Pets connected to the User Will.
Then on your CRED form where it has the Parent Field on the edit form page add this as the value [user_post_id author_id="[wpv-current-user info='id']" cpt='post']
Please try this and on the frontend it should auto select the parent on the frontend.
The code looks good but it's still not working... I'm just getting the select box saying -not set- for the parent field. I have attached a screenshot to demonstrate ..