Skip to content

Commit

Permalink
Phing release of v160909.7530 with the following changes:
Browse files Browse the repository at this point in the history
- **Bug Fix**: Fixed a "Notice: Array to string conversion" bug when getting available user downloads from WooCommerce. See [Issue #2](wpsharks/woocommerce-intercom-pro#2).
- **Enhancement**: The `total_spent` Custom Attribute is now padded to two decimal places, ensuring that a zero value gets passed as `0.00` and values that end in a zero include the padded zero (e.g., `5.50` instead of `5.5`). See [this commit](wpsharks/woocommerce-intercom-pro@86f8ac4).
- Updated WP PHP RV to v160824.6416.
  • Loading branch information
raamdev committed Sep 9, 2016
1 parent bbce0dd commit 07a9296
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .gitchange
@@ -1,2 +1,2 @@
1452806381
d0e05c36184f81b133761b71ca6ee0136be67409:57bf77dd732205.58864102
d0e05c36184f81b133761b71ca6ee0136be67409:57d2198b488a75.44143024
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,9 @@
## v160909.7530

- **Bug Fix**: Fixed a "Notice: Array to string conversion" bug when getting available user downloads from WooCommerce. See [Issue #2](https://github.com/websharks/woocommerce-intercom-pro/issues/2).
- **Enhancement**: The `total_spent` Custom Attribute is now padded to two decimal places, ensuring that a zero value gets passed as `0.00` and values that end in a zero include the padded zero (e.g., `5.50` instead of `5.5`). See [this commit](https://github.com/websharks/woocommerce-intercom-pro/commit/86f8ac436b7f69dab348ab3a0b502284dfd3d121).
- Updated WP PHP RV to v160824.6416.

## 160825.82407

- Initial release.
20 changes: 10 additions & 10 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugin.php
Expand Up @@ -4,7 +4,7 @@
*
* @wp-plugin
*
* Version: 160825.82407
* Version: 160909.7530
* Text Domain: woocommerce-intercom
* Plugin Name: WooCommerce Intercom Pro
*
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
@@ -1,6 +1,6 @@
=== WooCommerce Intercom ===

Stable tag: 160825.82407
Stable tag: 160909.7530

Tested up to: 4.6
Requires at least: 4.5.3
Expand Down
2 changes: 1 addition & 1 deletion src/includes/classes/App.php
Expand Up @@ -42,7 +42,7 @@ class App extends SCoreClasses\App
*
* @var string Version.
*/
const VERSION = '160825.82407'; //v//
const VERSION = '160909.7530'; //v//

/**
* Constructor.
Expand Down
11 changes: 9 additions & 2 deletions src/includes/classes/Utils/JsSnippet.php
Expand Up @@ -102,11 +102,18 @@ protected function customAttributes(): array
if (is_user_logged_in()) { // Only logged-in users
$current_user = wp_get_current_user();

$available_downloads = ''; // Initialize.
if (!empty($_wc_downloads = wc_get_customer_available_downloads($current_user->ID))) {
foreach ($_wc_downloads as $_download) {
$available_downloads[] = $_download['file']['name'];
}
} unset($_wc_downloads, $_download); // Housekeeping.

return [ // Intercom Custom Attributes http://bit.ly/2aZvEtb
'wp_login' => $current_user->user_login,
'wp_user_edit' => admin_url('user-edit.php?user_id='.$current_user->ID),
'available_downloads' => !empty(wc_get_customer_available_downloads($current_user->ID)) ? c::clip(implode(', ', wc_get_customer_available_downloads($current_user->ID)), 255) : '',
'total_spent' => !empty(wc_get_customer_total_spent($current_user->ID)) ? (float) wc_get_customer_total_spent($current_user->ID) : 0.00,
'available_downloads' => c::clip(implode(', ', $available_downloads), 255),
'total_spent' => sprintf('%0.2f', (float) wc_get_customer_total_spent($current_user->ID)), // Padded value to 2 decimal places, e.g. 0.00 or 5.50.
'total_orders' => wc_get_customer_order_count($current_user->ID),
'wp_roles' => c::clip(implode(', ', $current_user->roles), 255),

Expand Down

0 comments on commit 07a9296

Please sign in to comment.