diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-connect.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-connect.php index fa89fc83e..99d8fb65f 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-connect.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-connect.php @@ -543,7 +543,11 @@ public function get_usage_stat( $type, $stat = null ) { if ( 'limit' === $stat && isset( $this->usage[ $type ]['usage'] ) ) { $value = $this->usage[ $type ]['usage']; - } elseif ( 'used_percent' === $stat && isset( $this->usage[ $type ]['credits_usage'] ) ) { + } elseif ( + 'used_percent' === $stat + && isset( $this->usage[ $type ]['credits_usage'] ) + && ! empty( $this->usage['credits']['limit'] ) + ) { // Calculate percentage based on credit limit and usage. $value = round( $this->usage[ $type ]['credits_usage'] / $this->usage['credits']['limit'] * 100, 2 ); } diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/dashboard-content.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/dashboard-content.php index 08bc3313b..ddbbf25bd 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/dashboard-content.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/dashboard-content.php @@ -50,21 +50,29 @@ get_usage_stat( 'credits', 'limit' ) ) : ?> get_usage_stat( 'credits', 'limit' ) ) ); ?> - get_usage_stat( 'credits', 'used_percent' ) . '%' ); ?> | + get_usage_stat( 'credits', 'used_percent' ) ) : ?> + get_usage_stat( 'credits', 'used_percent' ) . '%' ); ?> | + get_usage_stat( 'storage', 'limit' ) ) ); ?> - get_usage_stat( 'storage', 'used_percent' ) . '%' ); ?> | + get_usage_stat( 'storage', 'used_percent' ) ) : ?> + get_usage_stat( 'storage', 'used_percent' ) . '%' ); ?> | + get_usage_stat( 'transformations', 'limit' ) ) ); ?> - get_usage_stat( 'transformations', 'used_percent' ) . '%' ); ?> | + get_usage_stat( 'transformations', 'used_percent' ) ) : ?> + get_usage_stat( 'transformations', 'used_percent' ) . '%' ); ?> | + get_usage_stat( 'bandwidth', 'limit' ) ) ); ?> - get_usage_stat( 'bandwidth', 'used_percent' ) . '%' ); ?> + get_usage_stat( 'bandwidth', 'used_percent' ) ) : ?> + get_usage_stat( 'bandwidth', 'used_percent' ) . '%' ); ?> +