From 562addafa023459e14902df886e29fe5d67ee2d6 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Wed, 16 Apr 2014 00:37:05 +0100 Subject: [PATCH] Issue #2231495 by ACF, andrei.dincu: Array to string conversion error when trying to add a new user. --- core/modules/contact/contact.module | 4 +++- core/modules/user/lib/Drupal/user/Tests/UserCreateTest.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/modules/contact/contact.module b/core/modules/contact/contact.module index 17db732bd324..5a165560dfd1 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 7ba715db3a72..d08beb12f718 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(