From 02324efc509d56a18b3905806f127d2968944c83 Mon Sep 17 00:00:00 2001 From: maximilianoRicoTabo Date: Wed, 18 Dec 2024 18:37:57 -0300 Subject: [PATCH] * If Clipboard API isn't supported remove all copy to clipboard buttons from the DOM * Add further buttons to allow copy to clibboard order ids, subscriptions id, payment and transaction ids. --- .../class-pmpro-discount-code-list-table.php | 2 +- classes/class-pmpro-orders-list-table.php | 17 ++++++- .../class-pmpro-subscriptions-list-table.php | 4 ++ css/admin.css | 4 +- js/pmpro-admin.js | 51 +++++++++++++------ 5 files changed, 59 insertions(+), 19 deletions(-) diff --git a/classes/class-pmpro-discount-code-list-table.php b/classes/class-pmpro-discount-code-list-table.php index 95365c86a..4ebfe7fb9 100644 --- a/classes/class-pmpro-discount-code-list-table.php +++ b/classes/class-pmpro-discount-code-list-table.php @@ -370,7 +370,7 @@ public function column_discount_code( $item ) { ?> code ); ?>
diff --git a/classes/class-pmpro-orders-list-table.php b/classes/class-pmpro-orders-list-table.php index 6804553f4..040e11192 100644 --- a/classes/class-pmpro-orders-list-table.php +++ b/classes/class-pmpro-orders-list-table.php @@ -891,6 +891,10 @@ public function column_order_id( $item ) { public function column_order_code( $item ) { ?> code ); ?> +
$value ) { - echo '

' . wp_kses_post( $value ) . '

'; + echo '

' . + wp_kses_post( $value ); + //we don't want to show the copy button for the empty column + if( $key !== 'none') { + ?> + + '; } } diff --git a/classes/class-pmpro-subscriptions-list-table.php b/classes/class-pmpro-subscriptions-list-table.php index 84f1aca51..04994fe0a 100644 --- a/classes/class-pmpro-subscriptions-list-table.php +++ b/classes/class-pmpro-subscriptions-list-table.php @@ -449,6 +449,10 @@ public function column_default( $item, $column_name ) { public function column_id( $item ) { ?> get_subscription_transaction_id() ); ?> +

{ $('.success-message').remove(); - $('.pmpro_copy_discount_code').show(); + $('.pmpro_copy_to_clipboard').show(); }, 3000); }) .catch(err => {