I am trying to allow users to edit the repeatable field groups of a custom post type. I have created a post form to allow a user to edit the post which they are an author of, and it is working (other than the bugs I've encountered and am working through).
I noticed that the post form builder did not allow adding fields for editing the RFG that are part of the posts (this was a terrible design decision on Toolset's part IMO), so I read on some other support topics that the RFG data for a post needs to be edited using a separate form.
So I created a separate form for editing the RFG "Fish Species". This form is displayed on the same page where the post form for editing the lodge is displayed. However, when I display the form I either get "No items found" or "Form type and post type do not match", depending on how I display it.
This is what I've done:
1. I've created a View that filters the posts by current author, so I can only show the post form for the Lodge post where the currently logged-in user is the author.
2. I've created the post form for the lodge. As mentioned this is working (sort of) and the user can edit the Lodge post which they authored.
3. I've created a post form for the Fish Species RFG. See species-form.jpg for how it's configured.
4. In the View I show both the form for editing the Lodge, then after that I show the form for editing the Fish Species RFG for that lodge, like this:
<wpv-loop>
<div class="preview-link"><a href="[wpv-post-url]" target="_blank" rel="noopener"><i class="far fa-external-link-alt"></i> Preview page</a></div>
[cred_form form='edit-lodge-details-page']
[cred_form form='edit-species-lodge-details-page']
</wpv-loop>
I need to allow the user to edit the RFG while editing the Lodge post data, so once I get the RFG form showing, I will move the RFG form into a modal using javascript, and the user can click "Edit Fish Species" at the point in the Lodge form where Fish species should appear.
5. I also created a different view that also filters the posts by current author, but this one shows the RFG form only, like this:
<wpv-loop>
[cred_form form='edit-species-lodge-details-page']
</wpv-loop>
I did this so that I could display the view, which would display the RFG form in a modal, which would appear when the user clicks "Edit Fish Species", as I described above.
When I display the page to edit the Lodge post, I see:
1. After the lodge form, where the RFG form should appear, it says "Form type and post type do not match".
2. In the modal, where I've embedded the view from 5., it says "No items found".
To replicate this:
1. Log in using the credentials below.
2. On the next page, click the button "Edit Lodge Details"
3. Scroll down to the "What we Catch" section and click "Edit Species" to see the results of the embedded View from 5.
Scroll down to the very bottom of the form to see the results of the embedded RFG form.