Unified user creation and update, deprecating 'languages' in favor of 'languageIDs'
authorAlexander Ebert <ebert@woltlab.com>
Sat, 28 Jun 2014 15:08:05 +0000 (17:08 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 28 Jun 2014 15:08:05 +0000 (17:08 +0200)
wcfsetup/install/files/lib/acp/form/UserAddForm.class.php
wcfsetup/install/files/lib/data/user/UserAction.class.php
wcfsetup/install/files/lib/form/RegisterForm.class.php

index a2644c9e6358bc60b90418935905a7015a786c8c..367924b446097e5108d9b0bd9ad3eb79e8bcd809 100644 (file)
@@ -264,7 +264,7 @@ class UserAddForm extends UserOptionListForm {
                                'signatureEnableHtml' => $this->signatureEnableHtml
                        )),
                        'groups' => $this->groupIDs,
-                       'languages' => $this->visibleLanguages,
+                       'languageIDs' => $this->visibleLanguages,
                        'options' => $saveOptions
                );
                
index c15355429bb710394031af808297436971046274..18e9555a88633e62571bfe13b7e4dbd91491c128 100644 (file)
@@ -275,8 +275,11 @@ class UserAction extends AbstractDatabaseObjectAction implements IClipboardActio
                $userEditor->addToGroups($groupIDs, false, $addDefaultGroups);
                
                // insert visible languages
-               $languageIDs = (isset($this->parameters['languages'])) ? $this->parameters['languages'] : array();
-               $userEditor->addToLanguages($languageIDs, false);
+               if (!isset($this->parameters['languageIDs'])) {
+                       // using the 'languages' key is deprecated since WCF 2.1, please use 'languageIDs' instead
+                       $this->parameters['languageIDs'] = (!empty($this->parameters['languages'])) ? $this->parameters['languages'] : array();
+               }
+               $userEditor->addToLanguages($this->parameters['languageIDs'], false);
                
                if (PACKAGE_ID) {
                        // set default notifications
index 50523370d232668301c48b539827d09a304b63e5..426efb68dc3129855231e9099ead0f8bf771a235 100644 (file)
@@ -438,7 +438,7 @@ class RegisterForm extends UserAddForm {
                                'password' => $this->password,
                        )),
                        'groups' => $this->groupIDs,
-                       'languages' => $this->visibleLanguages,
+                       'languageIDs' => $this->visibleLanguages,
                        'options' => $saveOptions,
                        'addDefaultGroups' => $addDefaultGroups
                );