Skip Navigation

[Resolved] Automatically connect post created with Form to an existing post using post relationships

This thread is resolved. Here is a description of the problem and solution.

Problem: I have a Form that creates posts. I would like to automatically link the new post to another post using post relationships.

Solution: Create a link to the new post Form that includes the existing post ID in a URL parameter. Then use a generic field in the new post Form to capture that post ID and pass it into a cred_save_data callback. Use the Post Relationships API to link the two posts.

Relevant Documentation:
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api
https://toolset.com/documentation/programmer-reference/cred-api/

This support ticket is created 5 years, 4 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
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)

This topic contains 18 replies, has 2 voices.

Last updated by DieterR7285 5 years, 3 months ago.

Assisted by: Christian Cox.

Author
Posts
#1342899

I see, could you point me into the right direction on implementing a conditional code.
You could test the current page ID in a conditional:

[wpv-conditional if="( '[wpv-post-id item="$current_page"]' ne '498' )"]
not 498
[/wpv-conditional]

One issue still bugging me, as reported above, is that the message "Relationship Saved" is constantly displayed in the member details page, any ideas!?
I need more information please. "Member details" page doesn't mean anything to me. Give me a URL and give me clear steps to reproduce the problem.

#1343639

Thanks I successfully integrated the current page conditional code snipped.

An example of the members details page in question would be hidden link. If you open any report member linked to a report i.e. hidden link have the message showing all the time.
In both cases you will have to be logged in as test user dbriedel.

#1343997
Screen Shot 2019-09-19 at 9.22.23 AM.png
Screen Shot 2019-09-19 at 9.22.32 AM.png
Screen Shot 2019-09-19 at 9.22.38 AM.png

This link contains a URL parameter that indicates you came to this page at some point after submitting Form 435:
hidden link
That's the astro-report-members-relationship Form. If you remove the URL parameter and visit the page without submitting the Form, the message should disappear, unless I'm misunderstanding something.

If you open any report member linked to a report i.e. hidden link have the message showing all the time.
Step 1. Log in as dbriedel
Step 2. Go to this URL: hidden link
Step 3. Click "View member details" for Manasi
Step 4. I should see the message appear now at this URL, correct? hidden link

However, I do not see the message appear now at that URL. I'm attaching screenshots of what I see.

#1344633

My issue is resolved now. Thank you!