fixed user edit form
This commit is contained in:
parent
83a6f13a10
commit
5bd907ec1e
|
@ -25,11 +25,13 @@ function materio_commerce_form_commerce_order_add_form_alter(&$form, &$form_stat
|
||||||
}
|
}
|
||||||
|
|
||||||
function materio_commerce_form_user_form_alter(&$form, &$form_state, $form_id) {
|
function materio_commerce_form_user_form_alter(&$form, &$form_state, $form_id) {
|
||||||
|
if ($form_id !== 'user_form') return;
|
||||||
|
|
||||||
$mail = $form['account']['mail']['#default_value'];
|
$mail = $form['account']['mail']['#default_value'];
|
||||||
$user_storage = \Drupal::entityTypeManager()->getStorage('user');
|
$user_storage = \Drupal::entityTypeManager()->getStorage('user');
|
||||||
$users = $user_storage->loadByProperties(['mail' => $mail]);
|
$users = $user_storage->loadByProperties(['mail' => $mail]);
|
||||||
$user = reset($users);
|
$user = reset($users);
|
||||||
$roles = $user->getRoles();
|
// $roles = $user->getRoles();
|
||||||
|
|
||||||
$license_storage = \Drupal::entityTypeManager()->getStorage('commerce_license');
|
$license_storage = \Drupal::entityTypeManager()->getStorage('commerce_license');
|
||||||
$licenses = $license_storage->loadByProperties(['uid' => $user->id()]);
|
$licenses = $license_storage->loadByProperties(['uid' => $user->id()]);
|
||||||
|
|
Loading…
Reference in New Issue