Skip to content

Commit 24d174c

Browse files
authored
Make notification dismissable forever + check if bcmath extension is installed and show a warning (#47)
* Show warning if bcmath extension is missing. * Allow users to dismiss review notification forever. * Sats-Mode avoid fatal error by not allowing user to activate when dependency not met. * Prepare release 2.6.1.
1 parent 7c9c521 commit 24d174c

File tree

7 files changed

+197
-135
lines changed

7 files changed

+197
-135
lines changed

assets/css/admin.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,9 @@
44
.btcpay-connection-error {
55
color: red;
66
}
7+
.btcpay-review-dismiss {
8+
margin-left: 20px;
9+
}
10+
.btcpay-review-dismiss-forever {
11+
margin-left: 10px;
12+
}

btcpay-greenfield-for-woocommerce.php

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Author URI: https://btcpayserver.org
88
* Text Domain: btcpay-greenfield-for-woocommerce
99
* Domain Path: /languages
10-
* Version: 2.6.0
10+
* Version: 2.6.1
1111
* Requires PHP: 8.0
1212
* Tested up to: 6.4
1313
* Requires at least: 5.9
@@ -26,7 +26,7 @@
2626

2727
defined( 'ABSPATH' ) || exit();
2828

29-
define( 'BTCPAYSERVER_VERSION', '2.6.0' );
29+
define( 'BTCPAYSERVER_VERSION', '2.6.1' );
3030
define( 'BTCPAYSERVER_VERSION_KEY', 'btcpay_gf_version' );
3131
define( 'BTCPAYSERVER_PLUGIN_FILE_PATH', plugin_dir_path( __FILE__ ) );
3232
define( 'BTCPAYSERVER_PLUGIN_URL', plugin_dir_url(__FILE__ ) );
@@ -183,14 +183,18 @@ public function legacyPluginNotification() {
183183
* Shows a notice on the admin dashboard to periodically ask for a review.
184184
*/
185185
public function submitReviewNotification() {
186-
if (!get_transient('btcpaygf_review_dismissed')) {
186+
if (!get_option('btcpay_gf_review_dismissed_forever') && !get_transient('btcpay_gf_review_dismissed')) {
187187
$reviewMessage = sprintf(
188-
__( 'Thank you for using BTCPay for WooCommerce! If you like the plugin, we would love if you %1$sleave us a review%2$s.', 'btcpay-greenfield-for-woocommerce' ),
188+
__( 'Thank you for using BTCPay for WooCommerce! If you like the plugin, we would love if you %1$sleave us a review%2$s. %3$sRemind me later%4$s %5$sStop reminding me forever!%6$s', 'btcpay-greenfield-for-woocommerce' ),
189189
'<a href="https://wordpress.org/support/plugin/btcpay-greenfield-for-woocommerce/reviews/?filter=5#new-post" target="_blank">',
190-
'</a>'
190+
'</a>',
191+
'<button class="btcpay-review-dismiss">',
192+
'</button>',
193+
'<button class="btcpay-review-dismiss-forever">',
194+
'</button>'
191195
);
192196

193-
Notice::addNotice('info', $reviewMessage, true, 'btcpay-review-notice');
197+
Notice::addNotice('info', $reviewMessage, false, 'btcpay-review-notice');
194198
}
195199
}
196200

@@ -321,8 +325,16 @@ public function processAjaxModalBlocksCheckout() {
321325
*/
322326
public function processAjaxNotification() {
323327
check_ajax_referer('btcpaygf-notifications-nonce', 'nonce');
324-
// Dismiss review notice for 30 days.
325-
set_transient('btcpaygf_review_dismissed', true, DAY_IN_SECONDS * 30);
328+
329+
$dismissForever = filter_var($_POST['dismiss_forever'], FILTER_VALIDATE_BOOL);
330+
331+
if ($dismissForever) {
332+
update_option('btcpay_gf_review_dismissed_forever', true);
333+
} else {
334+
// Dismiss review notice for 30 days.
335+
set_transient('btcpay_gf_review_dismissed', true, DAY_IN_SECONDS * 30);
336+
}
337+
326338
wp_send_json_success();
327339
}
328340

changelog.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
= 2.3.1 :: 2023-10-20 =
2+
* Fix: Ensure refunds text does not exceed API field limit.
3+
4+
= 2.3.0 :: 2023-09-06 =
5+
* Support for high performance order storage (HPOS)
6+
7+
Note: This is opt-in but brings performance improvements. Follow instructions [here](https://github.com/woocommerce/woocommerce/wiki/High-Performance-Order-Storage-Upgrade-Recipe-Book#how-to-enable-hpos) if you want to use it.
8+
9+
= 2.2.3 :: 2023-08-22 =
10+
* Automatically create webhook after redirect.
11+
12+
= 2.2.2 :: 2023-08-22 =
13+
* Fix edgecase JS error on payment method selection.
14+
15+
= 2.2.1 :: 2023-08-17 =
16+
* Add tooltip with webhook callback information
17+
18+
= 2.2.0 :: 2023-08-17 =
19+
* Refactor settings UI and allow manual webhook secret entry. This allows 3rd party integrators limit their API keys scope and not include the webhook permission.
20+
21+
= 2.1.0 :: 2023-04-03 =
22+
* New feature: Modal / Overlay checkout mode (no redirect to BTCPay Server)
23+
24+
= 2.0.0 :: 2023-03-20 =
25+
* New feature: Add support for refunds.
26+
27+
Note: If you are upgrading from a version < 2.0 and you want to use refunds (via pull payments) you need to create a new API key with the "Create non-approved pull payments" which is available from BTCPay Server version 1.7.6.
28+
See this link for more information: https://docs.btcpayserver.org/WooCommerce/#create-a-new-api-key
29+
30+
If you do NOT use refunds. You do NOT need to do anything, your existing API key and setup will continue to work as before.
31+
132
= 1.1.5 :: 2023-03-08 =
233
* Fix: fix error when plugins override delete_transient function not returning boolean value
334

0 commit comments

Comments
 (0)