Front-end templates are now theme-able, plus more changes in the latest major version 5.0.0 of the Bitcoin and Altcoin Wallets WordPress plugin.
Hope you are all staying healthy and safe from the virus. These are difficult times for all of us, but there is a silver lining: the next big increment of Bitcoin and Altcoin Wallets for WordPress is now released!
Action MAY be required on your part
This should affect only a small number of users:
If you have been using the
wallets_views_dir filter, or any shortcodes with the
views_dir attribute, there are breaking changes that may affect your site. Read on, or skip down to the TL;DR.
Previously all the markup for front-end UIs lived in
wp-content/plugins/wallets/includes/views. It was possible to copy these files to any other directory on the server and to modify them. If you have done so, you would have used the
wallets_views_dir in your theme’s code, or you may have been using the
views_dir attribute in your shortcodes to specify the new location.
This system was terrible. Not only was it hard to use, but also it did not easily allow for themes to override templates in a way that is familiar to theme developers.
Now the plugin features a template loader, much like bbPress, BuddyPress, WooCommerce, etc. So, what’s changed?
views_dirattribute no longer work. Using them writes a “doing_it_wrong” warning in your debug logs, if you have them enabled. If you are using these and you update to the latest version of the plugin, the shortcode UIs will revert to the default markup.
- The default templates now live in
wp-content/plugins/wallets/templates. This is a more standard location to put templates.
- The file names no longer depend on subdirectories. Instead, the naming convention follows the WordPress logic of generic and specialized parts. For example: The
[wallets_balance template="list"]shortcode would previously load
wp-content/plugins/wallets/includes/balance/list.php. Now the same shortcode will load the file
- It is now possible to copy template files into your theme. For example, if you were to use the
[wallets_balance template="list"]shortcode, and the file
wp-content/themes/YOUR-THEME/templates/wallets/balance-list.phpexists, it will take precedence over the plugin’s template.
- You only have to copy the files that you need to change. Any other UIs will fall back to using the templates provided in the plugin.
- It is also possible for child themes to override templates in the same way. Just place the files under
wp-content/themes/YOUR-CHILD-THEME/templates/wallets. Child themes take precedence over parent themes.
- These changes affect only the main plugin for now. Soon, the same changes will be applied to the Exchange extension and to the other extensions. There will be a blog announcement on this.
- The documentation has been updated to reflect these changes.
TL;DR If you have modified any front-end PHP templates, simply copy them into your theme or child theme, under
wp-content/themes/YOUR-THEME/template/wallets and follow the new naming convention: The filename for shortcode
[wallets_foo template="bar"] is now
foo-bar.php. No other changes are required.
There’s a bunch of small and large improvements in this release. A new QR-code scanner for withdrawals from mobile devices, more styling settings in Customizer, transaction summaries in the admin dashboard, etc. Here’s the complete changelog with all the tedious details:
- Improve: The UIs are now more easily overridable by themes. A template loader can load markup for these UIs from a theme or child theme, falling back to the plugin’s templates if needed.
- Change: The
wallets_views_dirattribute and filter are removed. Use theme templates instead to provide your custom markup.
- Add: The
[wallets_withdraw]shortcode can now scan addresses from QR code in devices that support it.
- Add: The opacity of UIs while loading data over AJAX can now be controlled in Customizer.
- Add: The border radius of UIs (corner roundness) can now be controlled in Customizer.
- Add: The colors used in
[wallets_transactions]shortcodes to signify transaction status can now be changed in Customizer.
- Add: Admin dashboard widget now shows multiple tabs with statistics on recent transactions.
- Add: When the plugin is network-active across a multisite install, the admin transactions list shows extra column Site.
- Improve: All operations that modify transaction data now also refresh the time on the
- Improve: Better integration with Simple History plugin. Transactions are now logged with clearer information, including links to user profiles and block explorers.
- Improve: The cold storage admin screens now also display the amount of funds locked in unaccepted & pending transactions.
- Add: The third-party service
coincap.iois now available as an Exchange Rates provider.
- Improve: In admin transactions list screen, amounts are now in fixed-font and align vertically for easier visual inspection.
- Improve: For Bitcoin-like adapters, the RPC secret is not shown in the markup, but bullets are shown instead. Improves security.
- Add: The
[wallets_api_key]shortcode can now be used as a widget.
- Fix: Adapters for fiat coins are no longer shown in the cold storage section, as these adapters are not backed by wallets.
- Improve: The Bitcoin address validator used in
[wallets_withdraw]now correctly allows Bitcoin testnet addresses. Useful for testing using testnet.
- Improve: When creating database tables for the first time, the WordPress default is used for character collation and encoding.
- Fix: When Bittrex is used as an Exchange Rates provider, if the last price is not available, the plugin falls back to using the average of the Bid/Ask values, or one of the two values if only one is available. Helps determine exchange rates in low liquidity markets.
- Improve: In the
[wallets_balance template="list"]UI, the text “Show zero balances” is clickable and toggles the checkbox. Improves usability.
- Improve: The plugin will now warn the user in the front-end if HTML comments have been minified, as this is a common pitfall for new users.
- Improve: In the debug tab of the admin dashboard, memory values are now shown with thousand separators and units (bytes) for easier visual inspection.
- Change: Bitcoin-like adapters now re-scan the entire wallet’s transaction list from the start weekly rather than monthly. This is a fail-safe mechanism that detects transactions that would otherwise slip through undetected if curl calls from
walletnotifywere to fail for any reason.
- Fix: Issue in email notifications for deposits, where the fees would not be shown correctly, is now fixed.
- Add: The cron-related debug information from the admin dashboard is now also shown in the admin cron job settings screen for easier reference.
- Change: Tradesatoshi is removed from list of Exchange Rate providers as the service is shut down.
- Fix: Issue with writing out CSVs when exporting transactions is now fixed.
- Improve: When manually adding a transaction using the
wallets_transactionsaction, it is now possible to specify an initial transaction status for withdrawals.
- Fix: In admin adapters screen, sorting by pending withdrawals no longer triggers a warning in the debug logs.
- Fix: When user requests a new deposit address via the
[wallets_deposit]shortcode, the other deposit addresses are now marked as old, and only the new one is current.
- Add: The
[wallets_balance template="list"]UI now includes a column for unavailable balance, i.e. balance that is locked in pending transactions or trades.
- Fix: The plugin now correctly calculates amount of wallet balance that is unavailable due to staking in more wallets, including PotCoin and Dash.
- Change: The plugin now warns the admin if the available balance is less than 5% of the total balance (previously the threshold was 1%).
- Fix: Some error messages that get printed only to the debug log are no longer translatable.
- Improve: Reduce number of calls to
- Fix: Some HTML markup errors in sidebar widgets are now fixed.