[Resolved] Linking multiple posts to a post in one-to-many relationship from the frontend
This thread is resolved. Here is a description of the problem and solution.
Problem:
The problem here is that the user is using the redirect settings on their form to reload the page that the form is on after it has been submitted, however instead of reloading the page they're redirected to the homepage.
Solution:
This is happening because the user is using the default permalink settings for wordpress instead of the postname permalink settings.
In order for the redirect to work correctly then you must use the postname permalink settings.
This support ticket is created 3 years, 2 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.
This is what I want to do. I have Custom Types: MEETINGS, PEOPLE and one-to-many relationship called ATTENDEES between MEETINGS and PEOPLE. I have a Post Form for MEETINGS where one fills out the Title, Date and Agenda and after submission I display the post. But I now what to link ATTENDEES to each meeting. As ATTENDEES is a one to many I have a relationship form that I have placed on the Content Template for MEETINGS. But each MEETING can have more than one ATTENDEE but I’m not sure how to set that up. I tried to select Reload Page after submission for the relationship form but that always goes back to the HOME page. I’d be grateful for the help how to set it up so that multiple PEOPLE can be linked to each meeting as ATTENDEES.
Is there any documentation that you are following?
Are you saying that after you've linked an ATTENDEE to a meeting and reload the page to link more ATTENDEES you're not able to and just get redirected to the homepage?
Would you mind allowing me to have admin access to the site so that I can have a more detailed look at this for you.
That didn't work for me. I tried setting "Set this post status:" to Published in the post form or just going directly from the link of the published post from the backend. In all cases after clicking SUBMIT after the post linking on the displayed post it forwards to /?cred_referrer_form_id=296501
I even tried with the post you created /?board-meeting=test-meeting and it too forwarded to ?cred_referrer_form_id=296501 which takes it to the home page.
Your Post Form that created the Board Meeting is setting the post status to Pending. This means the post isn't published. Try going to your Post Form and changing the status to submit the posts as published.
Alternatively you can manually go to the posts on the backend and publish the post from the post edit screen.
Yes that way it did work. But I need the permalink to work with the id becouse I have quite a bit of custom code alredy that relies on the id. Can this be made to work with the id?
I've been trying to get cred_success_redirect to work. But I don't think this filter is called for the SUBMIT when linking posts through a relationship. It is called for the create meetings form but not for the link users form. Is there another filter/hook? Is it possible to set the submit and redirect without using the [cred-form-submit] shortcode? Are there additional parameters in [cred-form-submit] shortcode that can be set directly?
To check that cred_success_redirect is called a set the follwing condition:
if ($form_data['id']==$fr_id {
return 'hidden link';
}
where $fr_id is 296501 (link site users form) or 296497 (create new meeting form)
As per cred_success_redirect documentation I set the redirect on 296501 (link site users form) to a page About Us. When $fr_id=296497 the redirect goes to google as expected but when it's equal to 296501 it goes to About Us. Unless the id is not 296501 but I checked it and it seems correct therefore I don't understand why there is no redirection through cred_success_redirect!!!
I dont believe this one is a bug. It could just be a case where the hook doesn't function with the Relationship forms and its only meant to work for Post Forms.
What I can do is to double check with our 2nd tier team to get a different perspective on the hook and let you know. I will provide an update as soon as I get a response.