Skip to content

wp_sync...action hook not being executed as async  #18

@pratikgup

Description

@pratikgup

Hi there, this plugin seems useful, but doesn't work for me in WP v4.7.5.

I'm trying to get a action hook from another plugin running asynchronously. This is the action hook I'm trying to run asynchronously https://www.gravityhelp.com/documentation/article/gform_after_submission/

I tried to incorporate that hook using similar steps described in the plugin's Github readme.

To just test the gform_after_submission_19 (where form id=19) action this is what I have added in my theme's function.php after activating the TechCrunch's plugin

if (class_exists('WP_Async_Task')) {

    class GF_Async_Task extends WP_Async_Task {
        
        protected $action = 'gform_after_submission_19';

        public function __construct() {
            parent::__construct(parent::BOTH);
        }
        protected function prepare_data($data) {
            return array(
                'entry' => $data[0],
                'form' => $data[1]
            );
        }
        protected function run_action() {
            if (isset($_POST['entry'])) {
                do_action("wp_async_$this->action", $_POST['entry'], $_POST['form']);
            }
        }
    }
}
function send_custom_notification($entry, $form) {
    error_log("test", 3, $_SERVER['DOCUMENT_ROOT'] . "/GFTEST.log");
}

add_action('wp_async_gform_after_submission_19', 'send_custom_notification', 10, 2);

function my_init_gf_task() {
    new GF_Async_Task();
}
add_action('plugins_loaded', 'my_init_gf_task');

But when I post the gravity form the expected action send_custom_notification action is just not doing the log
What could be wrong?

I also tried to set the sslverify option to false in the the launch_on_shutdown method of WP_Async_Task class by the editing original plugin file wp-async-task.php. I may needed to do this as i'm working on localhost for now.

But still no luck, any help/tips will be much appreciated, thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions