Skip to content

Commit

Permalink
Merge pull request #110 from AltaPay/fix-loggedin-user-memory-issue
Browse files Browse the repository at this point in the history
Fix: Memory issues encountered during checkout for logged-in users
  • Loading branch information
emicha authored Sep 9, 2024
2 parents 6774837 + 628a1be commit 09e266f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog
All notable changes to this project will be documented in this file.

## [3.7.1]
- Fix: Resolved memory issues encountered during checkout for logged-in users.

## [3.7.0]
- Fix compatibility issues with subscription payments using PHP 8.1.
- Fix issues with MobilePay subscriptions.
Expand Down
4 changes: 2 additions & 2 deletions altapay.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Author URI: https://altapay.com
* Text Domain: altapay
* Domain Path: /languages
* Version: 3.7.0
* Version: 3.7.1
* Name: SDM_Altapay
* WC requires at least: 3.9.0
* WC tested up to: 9.2.3
Expand Down Expand Up @@ -41,7 +41,7 @@
}

if ( ! defined( 'ALTAPAY_PLUGIN_VERSION' ) ) {
define( 'ALTAPAY_PLUGIN_VERSION', '3.7.0' );
define( 'ALTAPAY_PLUGIN_VERSION', '3.7.1' );
}

// Include the autoloader, so we can dynamically include the rest of the classes.
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: AltaPay, Gateway, Payments, WooCommerce, Payment Card Industry
Requires PHP: 7.4
Requires at least: 5.0
Tested up to: 6.6.1
Stable tag: 3.7.0
Stable tag: 3.7.1
License: MIT
WC requires at least: 3.9.0
WC tested up to: 9.2.3
Expand Down Expand Up @@ -39,6 +39,9 @@ AltaPay's Payment Gateway for WooCommerce provides merchants with access to a fu

== Changelog ==

= 3.7.1 =
* Fix: Memory issues encountered during checkout for logged-in users.

= 3.7.0 =
* Fix compatibility issues with subscription payments using PHP 8.1.
* Fix issues with MobilePay subscriptions.
Expand Down
12 changes: 4 additions & 8 deletions views/paymentClass.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -721,14 +721,10 @@ class WC_Gateway_{key} extends WC_Payment_Gateway {
$customer->setClientSessionID( crypt( session_id(), '$5$rounds=5000$customersessionid$' ) );

// Get user registration date
if ( is_user_logged_in() ) {
$users = get_users();
$currentUserId = get_current_user_id();
foreach ( $users as $user ) {
$userData = get_userdata( $currentUserId );
$customerCreatedDate = $altapayHelpers->convertDateTimeFormat( $userData->user_registered );
$customer->setCreatedDate( new \DateTime( $customerCreatedDate ) );
}
if ( is_user_logged_in() && $order->get_user_id() ) {
$userData = get_userdata( $order->get_user_id() );
$customerCreatedDate = $altapayHelpers->convertDateTimeFormat( $userData->user_registered );
$customer->setCreatedDate( new \DateTime( $customerCreatedDate ) );
}

return $customer;
Expand Down

0 comments on commit 09e266f

Please sign in to comment.