Gform_after_submission

I’m testing gform_after_submission. Docs say I should have the Entry object and Form object.

I am able to access the Entry object, but having trouble getting the form. Any ideas or tips?

Let’s see your code. Use a code sharing site, and share the link here. Include the add_filter line as well as your function. We can help figure out what is wrong or help you with some additional debugging.

Thanks so much, Chris.

Here’s a link to pastie.

The table ‘option’ is one I created, and my rpw_insert_option function is working fine for anything else I have sent to it.

If I just send $entry, it works fine. But with both ( $entry, $action ), nothing happens. If I just send $action, nothing happens.

I’ve also tried this with gform_post_payment_completed to no avail.

The original goal here was to insert data from the $Form object and $Entry object after a payment succeeds.

Hello. The function has two arguments: $entry and $form. It should be defined like this:

function rpw_update_room_sold( $entry, $form ) {

The second argument should be $form, not $action. You will need to define your function in this way to have access to the $form object. If you need your $action somewhere, you will need to get it into the function in some other way.

I will give that a try, thank you very much.

1 Like

Also, when you add the hook, make sure you set the $accepted_args to 2. See the two at the end here:

add_action( 'gform_after_submission', 'rpw_update_room_sold', 10, 2 );

1 Like

Thanks, Zack!!

1 Like