Skip Navigation

[Resolved] Displaying Pending Posts in Related Field CRED Form

This thread is resolved. Here is a description of the problem and solution.

Problem:

I want the search/dropdown field in a CRED form where a user connects relationships to be able to display all posts, even ones that are not published and only Pending Review.

Solution:

There isn't such kind of built-in feature withing Toolset Forms plugin, you can consider custom codes, for example:

https://toolset.com/forums/topic/displaying-pending-posts-in-related-field-cred-form/#post-2330549

Relevant Documentation:

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

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 4 replies, has 2 voices.

Last updated by simchaH 2 years, 9 months ago.

Assisted by: Luo Yang.

Author
Posts
#2327005

Hi,

I have my custom post forms A, B, & C all set to "Pending Review" when a user submits any of them. If someone now submits a post for CPT A, I want the user to be able to search for and select the related post in CPT B that was just added, even though it has the status of "Pending Review".

In short, I want the search/dropdown field in a CRED form where a user connects relationships to be able to display all posts, even ones that are not published and only Pending Review. This way, the user can connect a Post that they just added even though it is not Published yet (I want to review the info & approve Post myself, that's why it is set to pending). Is there a way to accomplish this?

Thanks,
Sim

#2328483

Hello,

There isn't such kind of built-in feature within Toolset Forms plugin.
As a workaround, you can try these:
Create a post view:
- Query posts of "CPT A"
- Enable post status filter:
https://toolset.com/documentation/user-guides/views/filtering-views-query-by-post-status/
- Setup the custom search form
- In view's loop, display the child post form link:
https://toolset.com/course-lesson/selecting-parent-posts-when-using-forms-to-create-child-items/#creating-forms-when-a-parent-post-is-preselected
section "Creating Forms with a Parent Post Preselected"

#2329243

I'm not sure if this directly answered my question? I already have a view with posts being displayed, but this is on the form page that I'm referring to. I want users that are visiting the form page to upload a post, to be able to select a related post that they just previously submitted but is currently under pending review so it isn't showing up in the dropdown option.

If the above answers this question would you be able to reiterate because I am just unsure how this helps?

Thank You,
Sim

#2330549

Thanks for the details, unfortunately, there isn't such kind of built-in feature withing Toolset Forms plugin, you can add a feature request for it:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

Currently, you can consider custom codes, for example:
1) In the Toolset post form, insert the general hidden field
https://toolset.com/documentation/programmer-reference/forms/cred-shortcodes/#cred_generic_field
set the default value as the URL parameter
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-search-term

2) After user submit the form, use action hook "cred_save_data" to trigger a PHP function
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
in this PHP function, get the hidden field value, use it to connect the parent pending post with the new child post
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_connect_posts

#2331203

My issue is resolved now. Thank you!