unregister(); } // delete the connected almefy identity on the almefy servers when a user is deleted locally. private function unregister() { add_action( 'delete_user', function ($user_id) { global $wpdb; $user = get_userdata( $user_id ); $email = $user->user_email; try { @Almefy::$client->deleteIdentity($email); } catch (\Throwable $th) { // user is not inside almefy console // TODO: send email if API error besides "does not exist" ? } } ); } } // register_activation_hook( __FILE__, 'my_activation' ); // add_action( 'my_hourly_event', 'do_this_hourly' ); // function my_activation() { // wp_schedule_event( time(), 'hourly', 'my_hourly_event' ); // } // function do_this_hourly() { // // do something every hour // } // register_deactivation_hook( __FILE__, 'my_deactivation' ); // function my_deactivation() { // wp_clear_scheduled_hook( 'my_hourly_event' ); // }