Skip Navigation

[Resolved] User submitted Quote on Custom post type

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.

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)

Author
Posts
#624372

Hi,

I've created a custom post type that makes it possible to create a "project / job". However I want other users to be able to submit their quote on projects placed by others.

How could I best do this as I'm not quite sure what's the best approach.

I was thinking about creating a custom taxonomy called "quotes" and create an attached form, however I have a feeling this could be done better. As the quote should be sent to the emailadress of the owner of the original post.

I've been searching the documentation but couldn't find a concrete answer / idea.

#624486

Hello,

You can try these:
1) create a custom post type "Quote" as child post type of "project":
https://toolset.com/documentation/user-guides/creating-post-type-relationships/

2) Create a CRED form for users to submit "Quote" posts:
https://toolset.com/documentation/user-guides/cred-forms-for-child-content/

3) In above CRED form, setup the "email notification" settings:
https://toolset.com/documentation/user-guides/automated-email-notifications-with-cred/

4) Add author of parent "project" post as the email notification recipient with CRED filter hook "cred_notification_recipients",
for example, add below codes into your theme/functions.php:

add_filter('cred_notification_recipients', 'my_cred_notification_recipients_func', 10, 4);
function my_cred_notification_recipients_func($recipients, $notification, $form_id, $post_id){
      
    if (12345 == $form_id){
        $parent_slug = "project";
        $field_slug = '_wpcf_belongs_' . $parent_slug . '_id';
          
        $parent_post_id = get_post_meta($post_id, $field_slug, true);
        $parent_post_author_id =  get_post_field ('post_author', $parent_post_id );
        $author_email = get_the_author_meta('user_email', parent_post_author_id );
        $recipients[] = array('to'=>'to', 'name'=>'', 'lastname'=>'', 'address'=>$author_email );
    }
    return $recipients;
}

Please replace 12345 with the CRED form ID of step 2

#624726

Thanks a lot for the detailed reply. It all worked up until the point where I had to Create a Child post link. For some reason when I search for a target page none of my pages can be found. Is there a workaround for this?

#624805

For the new problem:
For some reason when I search for a target page none of my pages can be found

I assume we are talking about display CRED form link for creating child "Quote" post in a single "project".

If it is, please follow our document to setup the CRED form link:
https://toolset.com/documentation/user-guides/cred-forms-for-child-content/#displaying-the-form

If the problem still exists, please check these:
1) Make sure you are using the latest version of Toolset plugins., you can download them here:
https://toolset.com/account/downloads/
2) Deactivate other plugins and switch to wordpress default theme, and test again
3) Create a new thread for the new question, describe detail steps to duplicate same problem, that will help other users to find the answers.