summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2014-04-15 23:37:05 (GMT)
committerAlex Pott2014-04-15 23:41:14 (GMT)
commit562addafa023459e14902df886e29fe5d67ee2d6 (patch)
tree325f3ec9e21a2845c9013782f231aea262558c9b
parent068dd7138f5966e2907394f3c4c8a007c9b5b1f5 (diff)
Issue #2231495 by ACF, andrei.dincu: Array to string conversion error when trying to add a new user.
-rw-r--r--core/modules/contact/contact.module4
-rw-r--r--core/modules/user/lib/Drupal/user/Tests/UserCreateTest.php2
2 files changed, 4 insertions, 2 deletions
diff --git a/core/modules/contact/contact.module b/core/modules/contact/contact.module
index 17db732..5a16556 100644
--- a/core/modules/contact/contact.module
+++ b/core/modules/contact/contact.module
@@ -208,7 +208,9 @@ function contact_form_user_form_alter(&$form, &$form_state) {
'#weight' => 5,
);
$account = $form_state['controller']->getEntity();
- $account_data = !\Drupal::currentUser()->isAnonymous() ? \Drupal::service('user.data')->get('contact', $account->id(), 'enabled') : NULL;
+ if (!\Drupal::currentUser()->isAnonymous() && $account->id()) {
+ $account_data = \Drupal::service('user.data')->get('contact', $account->id(), 'enabled');
+ }
$form['contact']['contact'] = array(
'#type' => 'checkbox',
'#title' => t('Personal contact form'),
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserCreateTest.php b/core/modules/user/lib/Drupal/user/Tests/UserCreateTest.php
index 7ba715d..d08beb1 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserCreateTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserCreateTest.php
@@ -19,7 +19,7 @@ class UserCreateTest extends WebTestBase {
*
* @var array
*/
- public static $modules = array('image');
+ public static $modules = array('image', 'contact');
public static function getInfo() {
return array(