# Gform\_after\_submission\_ does not seem to be firing

**URL:** <https://community.gravityforms.com/t/gform-after-submission-does-not-seem-to-be-firing/15633>\
**Category:** Get Help\
**Tags:** custom, gform\_after\_submission, private-methods\
**Created:** [August 2, 2023, 4:08pm UTC](https://community.gravityforms.com/t/gform-after-submission-does-not-seem-to-be-firing/15633 "2023-08-02T16:08:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![user63b57fde76bf1220](https://avatars.discourse-cdn.com/v4/letter/u/a698b9/32.png) [@user63b57fde76bf1220](https://community.gravityforms.com/u/user63b57fde76bf1220)\
**Post date:** [August 2, 2023, 4:08pm UTC](https://community.gravityforms.com/t/gform-after-submission-does-not-seem-to-be-firing/15633/1 "2023-08-02T16:08:52Z")

</div>

Hi All

Im trying to run some code after a form is submitted and before the redirect URL is returned to the client.

My form is in embedded into a learn dash course page and Im pretty sure its submitted via ajax.

My code is in a custom plugin file and the code works 100% if I call it directly. But doesn’t seem to fire when the hook is called.

Ive tried everything inside the callback function, print\_r(), die(), echo(), nothing is working in there.

Tia for the help!

```auto
<?php

namespace PreActive\Hooks;

use PreActive\Courses\Knpcourse;
use PreActive\User\Knpuser;

class Knppa
{
    public $sittingScore = [
        'low' => 24,
        'mid' => [24, 34],
        'high' => 34
    ];

    public $standingScore = [
        'low' => 25,
        'mid' => [25, 36],
        'high' => 36
    ];

    public function __construct()
    {
        //Run after the mobility form is submitted. NOT WORKING!
        add_action('gform_after_submission_4', [$this, 'knp_process_welcomecourse'], 10, 1);

        //Run directly from the browser (domain.com/?knoppys) works fine!
        if (isset($_GET['knoppys'])) {
            $this->knp_process_welcomecourse([18 => 'no']);
        }

    }

    private function knp_process_welcomecourse($entry)
    {

        //Get current user data
        $profile = new Knpuser();

        //Create new course
        $course = new Knpcourse();
        $course->new_course(20096);

        //Assign the new weeks
        $sitstand = $entry[18] == 'yes' ? 'standing' : 'seated';
        $course->assign_sit_stant_weeks($sitstand);

        //Update user profile
        $decodedData = $profile->get_user_profile();
        $decodedData['sit_stand_status'] = $sitstand;
        $profile->update_user_profile($decodedData);

    }

}

```

---

<div class="post-metadata">

**Author:** ![travislopes](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/travislopes/32/14645_2.png) [@travislopes](https://community.gravityforms.com/u/travislopes)\
**Post date:** [August 2, 2023, 5:21pm UTC](https://community.gravityforms.com/t/gform-after-submission-does-not-seem-to-be-firing/15633/2 "2023-08-02T17:21:43Z")

</div>

Your hook isn’t firing because private methods aren’t callable by external functions. If you make the method public, the hook should properly execute.

---

<div class="post-metadata">

**Author:** ![user63b57fde76bf1220](https://avatars.discourse-cdn.com/v4/letter/u/a698b9/32.png) [@user63b57fde76bf1220](https://community.gravityforms.com/u/user63b57fde76bf1220)\
**Post date:** [August 3, 2023, 8:27am UTC](https://community.gravityforms.com/t/gform-after-submission-does-not-seem-to-be-firing/15633/3 "2023-08-03T08:27:42Z")

</div>

🙈

Staring at code for too long, didn’t even see that!

Thank you!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/gravityforms1/original/2X/f/fef63f0599c45e0218c30d9f5d7ca8bff9b00189.png) [@system](https://community.gravityforms.com/u/system)\
**Post date:** [August 4, 2023, 8:27am UTC](https://community.gravityforms.com/t/gform-after-submission-does-not-seem-to-be-firing/15633/4 "2023-08-04T08:27:45Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
