id !== 'plugins') {
return;
}
?>
AACB_VERSION,
'url' => $site_url,
));
// Build form data matching /api/wp-feedback endpoint exactly like old plugin
$form_data = array(
'type' => 'deactivation',
'reason' => $reason,
'plugin' => $plugin_data,
);
// Add comment field with pattern: comment-{reason}
// Matches old plugin format expected by AllAccessible feedback endpoint
if (!empty($comment)) {
$comment_field = 'comment-' . $reason; // e.g., 'comment-stopped-working'
$form_data[$comment_field] = $comment;
}
// Send to AllAccessible feedback endpoint (URL-encoded form data)
wp_remote_post('https://app.allaccessible.org/api/wp-feedback', array(
'body' => $form_data,
'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
'timeout' => 5,
));
wp_send_json_success();
}
}
// Initialize deactivation survey
add_action('plugins_loaded', function() {
AllAccessible_DeactivationSurvey::get_instance();
});