Tell us what you are trying to do?
I have a post form which allows a guest to create a post for "Suppliers" set to "pending review". When the form is submitted, the new supplier is redirected to a form which displays a repeatable fields group. My problem is that the parent post is not available in the drop down that has to appear at the bottom of the form.
Is this because of the status of the parent post? What is the best way to deal with this do you think?
Is there any documentation that you are following?
I've been thinking and reading and I imagine that I will need a view on the second post form which relates to "suppliers" post type. Am I on the right track?
However, my selections in the query filter return forms for all the posts in the "suppliers" post type. And still they don't show a parent in the drop down.
I have made some progress today, but was hoping you might be able to help me figure out how I can change the post status after forms have been submitted. My workflow is as follows
Supplier on-boarding form (post): hidden link
First reference form (post): hidden link
Second reference form (post): hidden link—it would be good if I could change the status of the first post back to draft or pending at this stage
Supplier registration form (user): hidden link
…when a new person goes to the first form here: hidden link
they effectively create a new published post. So it surely shouldn't matter if the other posts are published or not. I need to be able to change all posts to draft for checking purposes.
Then the new supplier (author of the above post) is redirected here: hidden link where they should see the parent post they created belonging to the themselves (current author).
Also, I now have two forms appearing on the page. I've attached an image of this.
Shane, is it possible that I have this process completely the wrong way round?
Should I first of all use the User form to create a logged in user which then directs to the supplier on-boarding (post) form and then onto the references (post) form(s)?
It actually matters internally on status of the posts. Only posts with status that are Published will be publicly available. This means that only the posts that are published will be shown in the parent field even though we know that these posts have already been created.
Yes I agree that it shouldn't matter but it does in this case because a post only gets an author when it is set as published, also whoever publishes that posts becomes the author of the post. This is how wordpress works by default.
Secondly with the multiple forms. This is due to you having the form in a view. I don't see the reason for the view so I suggest removing the view and adding the form directly to the page.
Lastly i've tested the form and it works fine. I created a post and it was set to published when the form was submitted. Then on the RFG form I was able to select my "Test" post as an option.
Should I first of all use the User form to create a logged in user which then directs to the supplier on-boarding (post) form and then onto the references (post) form(s)?
It would be best to have your users have actual accounts on your site as this will allow them to have proper author settings for the supplier relationship field, given that you've set it to display only the posts for the current user.
I don't dispute the first two paragraphs and I have it set so that the post publishes.
I have removed the views – I was trying to make it so that the author only sees their own post in the drop down (what happens if there are hundreds of posts?)
But this is where it all falls apart for me:
"Lastly i've tested the form and it works fine. I created a post and it was set to published when the form was submitted. Then on the RFG form I was able to select my "Test" post as an option."
I have just made two posts and yet when I reach the RFG forms I still don't see anything in the drop down!
I was trying to make it so that the author only sees their own post in the drop down (what happens if there are hundreds of posts?)
Setting this on the form field itself is enough. Adding the form to a view has no bearing in what will show up here.
I have just made two posts and yet when I reach the RFG forms I still don't see anything in the drop down!
Can you record the steps that you're doing so that I can see how you're going through ? Also are you logged in as a user ?
Shane! Look! The posts I make incognito have no author!!! (see image)
When you made a post (logged in as me) I was assigned as author, which I guess is why you could see "Test" in the dropdown.
I suppose this answers my previous question about if you're logged in. That's correct, guests aren't users on the site so when they create a post wordpress doesn't know who to assign such post to. This is why I recommend that your users should be logged into actual accounts on your site to make this work properly.
The only other alternative is to not restrict the parent field by authors but this will cause all the posts to show up and the user will need to search the parent drop down for their post name.
I think I must've missed the step in the documentation! But I guess it goes without saying that a user needs to be logged in in order to be an author and add to their post! (Sorry for being such a numpty!)