# Gform\_after\_submission not executed after submit (GFCommon::log\_debug also not visible) \[RESOLVED\]

**URL:** <https://community.gravityforms.com/t/gform-after-submission-not-executed-after-submit-gfcommon-log-debug-also-not-visible-resolved/11688>\
**Category:** Get Help\
**Tags:** custom, logging, gform\_after\_submission\
**Created:** [January 23, 2022, 10:38pm UTC](https://community.gravityforms.com/t/gform-after-submission-not-executed-after-submit-gfcommon-log-debug-also-not-visible-resolved/11688 "2022-01-23T22:38:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![user61b6392ad8a7b606](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/user61b6392ad8a7b606/32/4440_2.png) [@user61b6392ad8a7b606](https://community.gravityforms.com/u/user61b6392ad8a7b606)\
**Post date:** [January 23, 2022, 10:38pm UTC](https://community.gravityforms.com/t/gform-after-submission-not-executed-after-submit-gfcommon-log-debug-also-not-visible-resolved/11688/1 "2022-01-23T22:38:04Z")

</div>

I’m developing a custom plugin inside this plugin i have developed some classes that need to do some data handling after a submission.

What I have tried is adding the `gform_after_submission` action, and hooked it with a function. Inside this function I’m running `GFCommon::log_debug` text for output a custom text to debugging file. But this output is not showing inside the log?

Example of the current code (without the class, only the add\_action and function):

```auto
add_action('gform_after_submission', 'gf_registration_form_payment_validation', 10, 2);
function gf_registration_form_payment_validation($entry, $form) {
   \GFCommon::log_debug('Form debug data:');
   \GFCommon::log_debug($entry);
}

```

On several forums they are saying that the add\_action hook needs to run before the gform\_after\_submission will be loaded? I have tried it with priority change but no success.

Hope somebody can help me further, thanks!

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [January 24, 2022, 4:23am UTC](https://community.gravityforms.com/t/gform-after-submission-not-executed-after-submit-gfcommon-log-debug-also-not-visible-resolved/11688/2 "2022-01-24T04:23:28Z")

</div>

Hello. I can tell you that gform\_after\_submission is pretty reliable - it runs after submission every time. You have the priority and the parameters correct, so there is probably something else going on with your code or your site.

Do you have Gravity Forms logging enabled already?

What is your Gravity Forms version?

If your Gravity Forms version is 2.2 or later, logging is built in to Gravity Forms core without any additional plugin. Documentation for Enabling Logging: [Logging and Debugging - Gravity Forms Documentation](https://docs.gravityforms.com/logging-and-debugging/#enabling-logging)

If logging is enabled, and you are using a recent Gravity Forms version, this will run when any Gravity Forms form is submitted:

```auto
add_action( 'gform_after_submission', 'gf_registration_form_payment_validation', 10, 2 );
function gf_registration_form_payment_validation( $entry, $form ) {
	GFCommon::log_debug( __METHOD__. '(): running.' );
	GFCommon::log_debug( __METHOD__. '(): The Entry => ' . print_r( $entry, true ) );
}

```

This will run when form 9 is submitted:

```auto
add_action( 'gform_after_submission_9', 'gf_registration_form_payment_validation', 10, 2 );
function gf_registration_form_payment_validation( $entry, $form ) {
	GFCommon::log_debug( __METHOD__. '(): running.' );
	GFCommon::log_debug( __METHOD__. '(): The Entry => ' . print_r( $entry, true ) );
}

```

---

<div class="post-metadata">

**Author:** ![user61b6392ad8a7b606](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/user61b6392ad8a7b606/32/4440_2.png) [@user61b6392ad8a7b606](https://community.gravityforms.com/u/user61b6392ad8a7b606)\
**Post date:** [January 24, 2022, 8:34am UTC](https://community.gravityforms.com/t/gform-after-submission-not-executed-after-submit-gfcommon-log-debug-also-not-visible-resolved/11688/3 "2022-01-24T08:34:19Z")

</div>

Hello Chris and readers,

Thank you for the detailed explanation.

Logging has been enabled and I’m using the latest version of GravityForms (2.5.16), the code explanation and what you are suggesting that’s what im currently doing also. Or I might not see what I’m doing wrong :).

I have transferred my code to a public repository and changed some classnames to make it more readable. The repository location: [GitHub - basewire/gf\_example\_plugin](https://github.com/basewire/gf_example_plugin)

The function where i’m running the action `gform_after_submission` can be found here: [gf\_example\_plugin/registration-form.php at master · basewire/gf\_example\_plugin · GitHub](https://github.com/basewire/gf_example_plugin/blob/master/classes/gravityforms/registration-form.php)

Hope somebody (Chris, or anybody who reads this) can help me further, thanks!

---

<div class="post-metadata">

**Author:** ![user61b6392ad8a7b606](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/user61b6392ad8a7b606/32/4440_2.png) [@user61b6392ad8a7b606](https://community.gravityforms.com/u/user61b6392ad8a7b606)\
**Post date:** [January 24, 2022, 9:26pm UTC](https://community.gravityforms.com/t/gform-after-submission-not-executed-after-submit-gfcommon-log-debug-also-not-visible-resolved/11688/4 "2022-01-24T21:26:47Z")

</div>

Ok, i have readed over and over it that made me blind 🙈 of the situation. The solution for my issue is:

Old and wrong situation:  
`add_action('gform_after_submission', [$this, 'gform_after_submission_function', 10, 2]);`

Needs to be transformed to:  
`add_action('gform_after_submission', [$this, 'gform_after_submission_function'], 10, 2);`

The priority and the accepted\_args needs to be out the function $this. This made the function not load when the gform\_after\_submission hook will be fired.

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [January 24, 2022, 9:28pm UTC](https://community.gravityforms.com/t/gform-after-submission-not-executed-after-submit-gfcommon-log-debug-also-not-visible-resolved/11688/5 "2022-01-24T21:28:35Z")

</div>

Closed on January 24, 2022, 9:28pm UTC


