| 34 |
$customerData['email'] = $account->mail; |
$customerData['email'] = $account->mail; |
| 35 |
$customerData['password_hash'] = $account->pass; |
$customerData['password_hash'] = $account->pass; |
| 36 |
//$customerData['store_id'] = 1; |
//$customerData['store_id'] = 1; |
| 37 |
//$customerData['website_id'] = 1; |
$customerData['website_id'] = magento_stores_get_default_website(); |
| 38 |
$customerData['group_id'] = magento_users_get_user_group($account); |
$customerData['group_id'] = magento_users_get_user_group($account); |
| 39 |
|
|
| 40 |
// find customer ID by email |
// find customer ID by email |
| 41 |
$customerId = magento_api_customer_get_customer_id_by_email($_SESSION['old_mail']); |
$customerId = magento_api_customer_get_customer_id_by_email($_SESSION['old_mail']); |
| 42 |
// create new Magento customer if not exists |
// create new Magento customer if not exists |
| 43 |
if ($customerId == FALSE) { |
if (!$customerId) { |
| 44 |
$result = magento_api_customer_create($customerData); |
$result = magento_api_customer_create($customerData); |
| 45 |
} else { |
} else { |
| 46 |
// update customer if exists |
// update customer if exists |
| 55 |
$customerData['email'] = $account->mail; |
$customerData['email'] = $account->mail; |
| 56 |
$customerData['password_hash'] = $account->pass; |
$customerData['password_hash'] = $account->pass; |
| 57 |
//$customerData['store_id'] = 1; |
//$customerData['store_id'] = 1; |
| 58 |
//$customerData['website_id'] = 1; |
$customerData['website_id'] = magento_stores_get_default_website(); |
| 59 |
|
|
| 60 |
$key = array_keys($account->roles); |
$key = array_keys($account->roles); |
| 61 |
// If user have only Auth. user role |
// If user have only Auth. user role |
| 77 |
//When you delete Drupal user, it deletes customer in Magento. |
//When you delete Drupal user, it deletes customer in Magento. |
| 78 |
$mail = array('email' => $account->mail); |
$mail = array('email' => $account->mail); |
| 79 |
$customerId = magento_api_customer_get_customer_id_by_email($mail); |
$customerId = magento_api_customer_get_customer_id_by_email($mail); |
| 80 |
if ($customerId != FALSE) { |
if ($customerId) { |
| 81 |
$result = magento_api_customer_delete($customerId); |
$result = magento_api_customer_delete($customerId); |
| 82 |
} |
} |
| 83 |
break; |
break; |