Skip to content

Commit

Permalink
Merge pull request #684 from modx-pro/3.0.2
Browse files Browse the repository at this point in the history
Добавлена возможность указать номер роли при регистрации пользователя
  • Loading branch information
biz87 committed May 20, 2022
2 parents 2567d4f + 2002263 commit 2e410a6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
6 changes: 5 additions & 1 deletion core/components/minishop2/docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [3.0.2-pl] - 2022-05-20

### Added
- The ability to update image previews in the product grid
- The ability to specify the role number when registering a user
- Lost system setting ms2_cart_max_count

### Changed
- msCartHandler, msOrderHandler, msDeliveryHandler, msPaymentHandler deprecated file notifications now listen to the log_deprecated system setting
- Escaping of the rank field to support mysql 8
- Added the ability to update image previews in the product grid

## [3.0.1-pl] - 2022-05-04

Expand Down
16 changes: 13 additions & 3 deletions core/components/minishop2/model/minishop2/minishop2.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -710,9 +710,19 @@ public function getCustomerId()
if (!$customer->save()) {
$customer = null;
} elseif ($groups = $this->modx->getOption('ms2_order_user_groups', null, false)) {
$groups = array_map('trim', explode(',', $groups));
foreach ($groups as $group) {
$customer->joinGroup($group);
$groupRoles = array_map('trim', explode(',', $groups));
foreach ($groupRoles as $groupRole) {
$groupRole = explode(':', $groupRole);
if (count($groupRole) > 1 && !empty($groupRole[1])) {
if (is_numeric($groupRole[1])) {
$roleId = (int)$groupRole[1];
} else {
$roleId = $groupRole[1];
}
} else {
$roleId = null;
}
$customer->joinGroup($groupRole[0], $roleId);
}
}
}
Expand Down

0 comments on commit 2e410a6

Please sign in to comment.