Skip to content

Commit

Permalink
Set the initial admin account's language during install
Browse files Browse the repository at this point in the history
Resolves #2480
  • Loading branch information
brandonkelly committed Feb 22, 2018
1 parent 9664a01 commit 7a0a6e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Element query classes can now specify the default `orderBy` value by overriding `craft\elements\db\ElementQuery::defaultOrderBy`.
- The Photo field on Edit User pages now has `id="photo"`. ([#2469](https://github.com/craftcms/cms/pull/2469))
- Built-in element types now support several more attributes in their array representations.
- The system installer now sets the initial admin account’s preferred language to the site language selected in the installation wizard. ([#2480](https://github.com/craftcms/cms/issues/2480))

### Deprecated
- Deprecated `craft\elements\Asset::getHasUrls()`.
Expand Down
5 changes: 5 additions & 0 deletions src/migrations/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ public function safeUp()
Craft::$app->getElements()->saveElement($user);
echo " done\n";

// Set their preferred language
Craft::$app->getUsers()->saveUserPreferences($user, [
'language' => $this->site->language,
]);

// Log them in
if (!Craft::$app->getRequest()->getIsConsoleRequest()) {
Craft::$app->getUser()->login($user);
Expand Down

0 comments on commit 7a0a6e4

Please sign in to comment.