Skip Navigation

[Resolved] [cred-post-parent get='id'] is not working inside [wpv-view name='my-view']

This support ticket is created 6 years, 8 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 10 replies, has 2 voices.

Last updated by Khurram 6 years, 8 months ago.

Assisted by: Shane.

Author
Posts
#557721

I am trying to:

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.

I used [wpv-post-param] mentioned here https://toolset.com/forums/topic/how-can-my-view-access-a-url-parameter-in-a-query-string/ by Cardid. But obviously due to GET it is not working in Committee Member Edit Form.

Link to a page where the issue can be seen:

I expected to see:

Instead, I got:

#557885

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Khurram,

Thank you for contacting our support forum.

What is it that you want to pass to your view ? The ID of the parent post that this view is being shown ?

Please let me know.
Thanks,
Shane

#558043

Hi Shane,

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.

#558214

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Khurram,

I understand now.

Would you mind providing me with admin access to the website so that I can have a look at the issue ?

Please let me know the exact page where I can observe the problem as well.

Thanks,
Shane

#558642

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Khurram,

I see the issue now.

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']

Please let me know if this helps.
Thanks,
Shane

#559125

Hi Shane,

In my original post I mentioned that there is no parent id passed in CRED edit form, what would be the solution for CRED edit form?

#559128

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?

#559544

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Khurram,

The post parent is actually passed as a url parameter. I saw what you meant by the parent id information on the edit form.

As an alternative you can use this shortcode here.
[wpv-post-field name="_wpcf_belongs_event_id"]

Please let me know if this helps.
Thanks,
Shane

#559586

Hi Shane,

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.

Regards,
Khurram

#559604

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Khurram,

Let me see how best I can clarify for you.

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.

Thanks,
Shane

#559608

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.

Regards,
Khurram Zafar

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.