From 518d0f9432a6484a0337d8c52cae00b09b4cd054 Mon Sep 17 00:00:00 2001 From: Alex P Date: Wed, 10 Aug 2022 09:20:47 +0300 Subject: [PATCH 1/2] Add links to docs & support in plugin --- woocommerce-paypal-payments.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/woocommerce-paypal-payments.php b/woocommerce-paypal-payments.php index 6dc5feb05..d8827fe0a 100644 --- a/woocommerce-paypal-payments.php +++ b/woocommerce-paypal-payments.php @@ -122,10 +122,26 @@ define( 'PPCP_FLAG_SEPARATE_APM_BUTTONS', apply_filters( 'woocommerce_paypal_pay } ); - // Add "Settings" link to Plugins screen. + // Add "Settings", "Docs", "Support" links to Plugins screen. add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), function( $links ) { + $links = array_merge( + array( + sprintf( + '%2$s', + 'https://woocommerce.com/document/woocommerce-paypal-payments/', + __( 'Docs', 'woocommerce-paypal-payments' ) + ), + sprintf( + '%2$s', + 'https://woocommerce.com/my-account/create-a-ticket/', + __( 'Support', 'woocommerce-paypal-payments' ) + ), + ), + $links + ); + if ( ! is_woocommerce_activated() ) { return $links; } From b37942040ad5b8894ea4adad0c569dd53cc2f032 Mon Sep 17 00:00:00 2001 From: Alex P Date: Tue, 16 Aug 2022 10:31:47 +0300 Subject: [PATCH 2/2] Put docs/support links below description --- woocommerce-paypal-payments.php | 56 +++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/woocommerce-paypal-payments.php b/woocommerce-paypal-payments.php index d8827fe0a..c9b04e646 100644 --- a/woocommerce-paypal-payments.php +++ b/woocommerce-paypal-payments.php @@ -122,26 +122,10 @@ define( 'PPCP_FLAG_SEPARATE_APM_BUTTONS', apply_filters( 'woocommerce_paypal_pay } ); - // Add "Settings", "Docs", "Support" links to Plugins screen. + // Add "Settings" link to Plugins screen. add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), function( $links ) { - $links = array_merge( - array( - sprintf( - '%2$s', - 'https://woocommerce.com/document/woocommerce-paypal-payments/', - __( 'Docs', 'woocommerce-paypal-payments' ) - ), - sprintf( - '%2$s', - 'https://woocommerce.com/my-account/create-a-ticket/', - __( 'Support', 'woocommerce-paypal-payments' ) - ), - ), - $links - ); - if ( ! is_woocommerce_activated() ) { return $links; } @@ -159,6 +143,44 @@ define( 'PPCP_FLAG_SEPARATE_APM_BUTTONS', apply_filters( 'woocommerce_paypal_pay } ); + // Add links below the description on the Plugins page. + add_filter( + 'plugin_row_meta', + function( $links, $file ) { + if ( plugin_basename( __FILE__ ) !== $file ) { + return $links; + } + + return array_merge( + $links, + array( + sprintf( + '%2$s', + 'https://woocommerce.com/document/woocommerce-paypal-payments/', + __( 'Documentation', 'woocommerce-paypal-payments' ) + ), + sprintf( + '%2$s', + 'https://woocommerce.com/my-account/create-a-ticket/', + __( 'Get help', 'woocommerce-paypal-payments' ) + ), + sprintf( + '%2$s', + 'https://woocommerce.com/feature-requests/woocommerce-paypal-payments/', + __( 'Request a feature', 'woocommerce-paypal-payments' ) + ), + sprintf( + '%2$s', + 'https://github.com/woocommerce/woocommerce-paypal-payments/issues/new?assignees=&labels=type%3A+bug&template=bug_report.md', + __( 'Submit a bug', 'woocommerce-paypal-payments' ) + ), + ) + ); + }, + 10, + 2 + ); + /** * Check if WooCommerce is active. *