diff --git a/includes/Deactivation.php b/includes/Deactivation.php index 73787f5..c9b38b1 100644 --- a/includes/Deactivation.php +++ b/includes/Deactivation.php @@ -47,7 +47,11 @@ public function __construct( Container $container ) { * @return void */ public function handle() { - $this->site_launched_event(); + /* + * The data module is currently handing the 'site_launched' event. + * We are commenting out the code below but keeping it as example for future events. + */ + // $this->site_launched_event(); $this->disable_coming_soon(); } diff --git a/includes/Events/Event.php b/includes/Events/Event.php index ca50aa4..18aa26b 100644 --- a/includes/Events/Event.php +++ b/includes/Events/Event.php @@ -64,7 +64,7 @@ public function __construct( $category = 'plugin_deactivation', $data = array() /** * Send the event to the data module endpoint. * - * @return void + * @return WP_REST_Response REST response */ public function sendEvent() { $event = array( @@ -73,8 +73,8 @@ public function sendEvent() { 'data' => $this->data, 'queue' => false, ); - - $request = $this->request->set_body_params( $event ); - rest_do_request( $request ); + + $this->request->set_body( wp_json_encode( $event ) ); + return rest_do_request( $this->request ); } } diff --git a/includes/Events/SiteLaunched.php b/includes/Events/SiteLaunched.php index 80ebb64..4c555f6 100644 --- a/includes/Events/SiteLaunched.php +++ b/includes/Events/SiteLaunched.php @@ -12,7 +12,7 @@ */ class SiteLaunched extends Event { /** - * Constructor. + * send event. * * @return void */ @@ -21,7 +21,7 @@ public function send() { $this->data = array( 'ttl' => $this->getInstallTime(), ); - + return $this->sendEvent(); } @@ -35,4 +35,4 @@ private function getInstallTime() { return time() - strtotime( $mm_install_time ); } -} \ No newline at end of file +}