Skip to content

Commit

Permalink
Add a "deactivated" message to the plugins list entry (#2759)
Browse files Browse the repository at this point in the history
* Add a "deactivated" message to the plugins list entry

* Update woocommerce-services.php

Co-authored-by: Gerhard Potgieter <potgieterg@gmail.com>

* Address PR comments

* Remove redundant `esc_html`

* Customize the after_plugin_row action for this plugin only

* Fix background color of deactivated message

---------

Co-authored-by: Gerhard Potgieter <potgieterg@gmail.com>
  • Loading branch information
Ferdev and kloon committed Jul 30, 2024
1 parent 3eeef31 commit 2d27e72
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions woocommerce-services.php
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,7 @@ public function init_shipping() {
add_filter( 'woocommerce_hidden_order_itemmeta', array( $this, 'hide_wc_connect_package_meta_data' ) );
add_filter( 'is_protected_meta', array( $this, 'hide_wc_connect_order_meta_data' ), 10, 3 );
add_action( 'current_screen', array( $this, 'edit_orders_page_actions' ) );
add_action( 'after_plugin_row_woocommerce-services/woocommerce-services.php', array( $this, 'add_custom_message_to_plugin_list' ), 10, 2 );
}

/**
Expand Down Expand Up @@ -1562,6 +1563,30 @@ public function edit_orders_page_actions() {
}
}

/**
* Add a "deactivated" message to the plugin list table for WooCommerce Shipping & Tax
*
* @param string $plugin_file
* @param array $plugin_data
*/
public function add_custom_message_to_plugin_list() {
if ( false ) {
printf(
'<style>
.plugins tr[data-slug="woocommerce-services"] td, .plugins tr[data-slug="woocommerce-services"] th { box-shadow: none; }
</style>
<tr class="plugin-update-tr active update">
<td colspan="4" class="plugin-update colspanchange">
<div class="notice inline notice-warning" style="border:0; border-left: 5px solid #4AB866; padding: 12px; background-color: #EFF9F1;">
<p>%s</p>
</div>
</td>
</tr>',
wp_kses_post( __( 'WooCommerce Shipping & Tax has been deactivated. Your data and settings have been carried over to the dedicated WooCommerce Shipping and WooCommerce Tax extensions.<br />For support, please <a href="https://woocommerce.com/my-account/create-a-ticket/">contact our Happiness Engineers</a>.', 'woocommerce-services' ) )
);
}
}

/**
* Registers the React UI bundle
*/
Expand Down

0 comments on commit 2d27e72

Please sign in to comment.