Skip Navigation

[Resolved] Automatic (pre) selection of all parents in child cred form

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

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

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 8 years ago.

Assisted by: Luo Yang.

Author
Posts
#385268

I am trying to:
In a child CRED form to automatically pre select all possible parents from the current logged in author. The goal is that the user cannot select anything, thus that the fields are hidden. Thus in the cred form normally the parent can be selected per CPT like this:

 
[cred_field field='_wpcf_belongs_parent1_id' value='' ]
[cred_field field='_wpcf_belongs_parent2_id' value='' ]

So the value have to be post id of the the parent written by the current logged in author. For this I made two simple views. The views gives the correct parent post id, but the value field does not accept the view shortcode. It does work when I manually fill in the the post ID returned by my view shortcode.

 
view shorcode: 
[wpv-view name="parent-own-author"]

What I tried:
[cred_field field='_wpcf_belongs_parent2_id' value='[wpv-view name="parent-own-author"]' ]

_How the view looks___________________________________________________
	<!-- wpv-loop-start -->
		<wpv-loop>
          [wpv-post-id]
		</wpv-loop>
	<!-- wpv-loop-end -->

On the forum and documentatation I found this:
https://toolset.com/forums/topic/cred-forms-for-child-content-can-you-lock-the-selection-of-parent/

Which is close but does not really achieve what I want.

#386068

Dear ward,

You can try this:
1) use CRED generic selct field to replace the CRED shortcode [cred_field field='_wpcf_belongs_parent1_id' value='' ]
cred-generic-field
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred-generic-field
2) create a view to list parent posts of current user:
Filtering Views Query by Author
https://toolset.com/documentation/user-guides/filtering-views-query-by-author/

3) and setup the out of above view in step 2) as options of the generic selct field of step 1)
see similar thread:
https://toolset.com/forums/topic/upgrade-to-views-1-11-broke-a-cred-cred_generic_field-select-populated-by-a-view/

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