Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert 69331: ETK deactivation message on unlaunched site #79889

Merged
merged 1 commit into from
Jul 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -418,39 +418,3 @@ function load_wpcom_domain_upsell_callout() {
require_once __DIR__ . '/wpcom-domain-upsell-callout/class-wpcom-domain-upsell-callout.php';
}
add_action( 'plugins_loaded', __NAMESPACE__ . '\load_wpcom_domain_upsell_callout' );
/**
* Shows a confirm prompt when the plugin is about to be deactivated on a unlaunched site.
*
* This will filter the FSE actions on the plugin manager list to add the confirm
* prompt on the click event of the action=deactivate.
*
* The option launch-status exists only on wpcom sites.
*
* @TODO: Remove after coming-soon is migrated to the new jetpack-mu-wpcom plugin
*/
if ( has_action( 'plugins_loaded', 'Jetpack\Mu_Wpcom\load_coming_soon' ) === false ) {
add_filter(
'plugin_action_links_' . plugin_basename( __FILE__ ),
function ( $actions ) {
$unlaunched = get_option( 'launch-status' ) === 'unlaunched';

if ( $unlaunched ) {
$actions = array_map(
function ( $action ) {
$message = __( 'Disabling this plugin will make your site public.', 'full-site-editing' );
$confirm = "confirm('$message') ? null : event.preventDefault()";

return str_replace(
'<a href="plugins.php?action=deactivate',
"<a onclick=\"$confirm\" href=\"plugins.php?action=deactivate",
$action
);
},
$actions
);
}

return $actions;
}
);
}