Skip to content

Commit

Permalink
Fix mix customer ID and Mollie ID, see 5c739d2.
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed May 3, 2024
1 parent aa1006a commit e2e47fa
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/CustomerDataStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,21 @@ public function save_customer( Customer $customer, $data = [], $format = [] ) {
public function connect_mollie_customer_to_wp_user( $customer, \WP_User $user ) {
global $wpdb;

$customer_id = $wpdb->get_var(
$wpdb->prepare(
"SELECT id FROM $wpdb->pronamic_pay_mollie_customers WHERE mollie_id = %s;",
$customer->get_id()
)
);

if ( null === $customer_id ) {
return;
}

$row = $wpdb->get_row(
$wpdb->prepare(
"SELECT * FROM $wpdb->pronamic_pay_mollie_customer_users WHERE customer_id = %d AND user_id = %d;",
$customer->get_id(),
$customer_id,
$user->ID
)
);
Expand All @@ -220,7 +231,7 @@ public function connect_mollie_customer_to_wp_user( $customer, \WP_User $user )
}

$data = [
'customer_id' => $customer->get_id(),
'customer_id' => $customer_id,
'user_id' => $user->ID,
];

Expand Down

0 comments on commit e2e47fa

Please sign in to comment.