Skip Navigation

[Résolu] Auto set parent for child-post, based on logged in user

This support ticket is created Il y a 7 années et 2 mois. 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 – 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 2 réponses, has 2 voix.

Last updated by JackO Il y a 7 années et 2 mois.

Assisted by: Luo Yang.

Auteur
Publications
#479920

Hello,

I am trying to make a CRED form for a child post, with the parent post automatically assigned. There are several solutions on these forums to do that, however none apply to my situation. All solutions I find are based on a link to the Child CRED from from the Parent page. My situation is different.

The set-up is:

1. User must be logged in.
2. After logging in, the user has access to a personal account page
2. Every user is author of a specific CPT.
3. This CPT is the parent of a Child-CPT
4. Users are able to create multiple Child-CPT pages. The CRED form for this is not linked to from the Parent-CPT, but from the account page.
5. The author of the Parent CPT and the Child CPT are the same - the logged-in user.

I would like the users to be able to create a Child-CPT with a CRED from. This form is linked to from the account page. The parent should be automatically assigned to the Parent CPT page from the same author that is creating the Child CPT.

How could I make this happen?

Thank you!

#480158

Dear Jack,

You can try these:
1) create a CRED form for creating the child CPT post, in the CRED form, setup some CSS codes to hide the dropdown menu for select parent post
https://toolset.com/documentation/user-guides/cred-forms-for-child-content/

2) Create a view, list the parent CPT posts, filter by:
Post author is the same as the logged in user,
and display the link for creating the it's child post
https://toolset.com/documentation/user-guides/filtering-views-query-by-author/

and display above view in the account page for user to create the child CPT posts.

#480172

This works great, thank you!

And for other users who might use this solution in the future: this is the CSS code to hide the dropdown for selecting the parent post.

.cred-group-parents {display:none;}
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.