PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Set Post Status and User Registration based on value of a drop down field

  1. Maybe I am trying to do too much with one form. I am using GF with PayPal Pro, MailChimp, and User Registration,

    I have a membership registration form that will create a new "Member record" (custom post type), register the user, sign them up on MailChimp list. I have a drop down field to select to pay either by check (I attach an invoice to the notification email) or to pay via credit/debit card (using PayPal pro) if they select the option, process the dues payment via PayPal Payments Pro.

    Here is where I am stuck. I want to create the post as a draft, create a user guest role account and sign them up for the if they select to pay by check. If they select and successfully pay via PayPal payments Pro, I would like the post to be created as published, and the user to be set up as an editor role.

    I am thinking perhaps I need a pre-submission hook based on payment type field. Or would it require different feeds, or both?

    Posted 11 years ago on Wednesday October 31, 2012 | Permalink
  2. Ok, I found the gform_post_data hook information to set the $post_data["post_status"]. It works like a charm.

    Here is the script I used:

    add_filter("gform_post_data", "change_post_status", 10, 3);
    function change_post_status($post_data, $form, $entry){
        //only change post status on form id 1
        if($form["id"] != 1)
           return $post_data;
        //  Get payment selection choice
        $pay_type = $entry["37"];
        if ($pay_type == "Check")
           $post_data["post_status"] = "draft";
        if ($pay_type == "Card")
            $post_data["post_status"] = "publish";
        return $post_data;
    }
    Posted 11 years ago on Wednesday October 31, 2012 | Permalink
  3. That's a good way of doing it. Thanks for posting your solution.

    Posted 11 years ago on Thursday November 1, 2012 | Permalink

This topic has been resolved and has been closed to new replies.