I have parent Committees and child Committee-Members. I have created committee-member-add form, that I called from Committee post screen. Till here everything is good.
I have created a view to list down committee members say 'my-view' with shortcode 'committeeid' ([wpv-view name='my-view' committeeid='123']). View is working fine in Committee post display and else where with shortcode 'committeeid'. I called the view in committee-member-add from in after [/credform] with syntax [wpv-view name="my-view" committeeid="[cred-post-parent get='id' post_type='committee']"], but here view is showing members of all committee. I tested [cred-post-parent get='id' post_type='committee'] separately and it is outputting correct parent id.
I tried this on fresh installation and this is reproduce able.
The view is shown in cred form and I am passing the id of parent of cred form. Committee(Parent)->Committee Member(Child), in Committee Member I am showing the view id got by cred-post-parent shortcode.
It could be that the CRED shortcode is meant for use only within the context of CRED, however the parent ID is passed in the url so you can use this to filter the view.
[wpv-search-term param='parent_event_id']
I tried view in different places, before closing of form etc. but the result is same. What does it meant technically by 'in context of CRED forms'? I tried [cred-post-parent] shortcode to output the raw data which seems to be same, is there output format difference?
Both your solutions worked for New Post Form and for Edit Post Form. To clarify concept;
1. [cred-parent-post] works in context of form? Do you mean that Views would be rendered first and after that cred form would be rendered that's why we are not able to pass cred form shortcodes to Views.
2. Post meta is not available for new form, that's why we are calling URL param to identify parent.
3. Post meta is available for Editing Forms but param is not available that's why we are calling _wpcf_belongs_parent_id field.
I would suggest to make these as part of Cred Parent Child documentation, as I have seen a couple of subscribers asking for same questions and writing custom codes.
Appreciate your effort in getting towards a solution.
1. [cred-parent-post] this shortcode works fine in your form, however its not able to pass the value of to a view, in this case you will need to use the views shortcode that i've used.
2. That is correct, since in the edit form the post already has the meta set.
3. That is correct, there is always some way of getting the parent information.
That would be a good suggestion to include these multiple methods to get the parent information.
Thank you Shane. Including these methods would be very helpful. Traditionally clients wants to see the sibling data while adding / editing new child data for parent post. For that reason we used to show grid of sibling data at bottom of adding / editing pages.