diff -u b/plugins/FeedsUserProcessor.inc b/plugins/FeedsUserProcessor.inc --- b/plugins/FeedsUserProcessor.inc +++ b/plugins/FeedsUserProcessor.inc @@ -104,6 +104,11 @@ if (empty($account->name) || empty($account->mail) || !valid_email_address($account->mail)) { throw new FeedsValidationException(t('User name missing or email not valid.')); } + + // Timezone validation. + if (!empty($account->timezone) && !array_key_exists($account->timezone, system_time_zones())) { + throw new FeedsValidationException(t("User's timezone is not valid.")); + } } /** @@ -238,7 +243,7 @@ break; case 'timezone': - $this->setTimezoneTarget($source, $target_user, $target_element, $value, $mapping); + $target_user->timezone = $value; break; default: @@ -630,17 +635,2 @@ } - - /** - * Sets the timezone on the user target. - * - * @see setTargetElement() - */ - protected function setTimezoneTarget($source, $target_user, $target_element, $value) { - // Set timezone if the value is valid. - if (array_key_exists($value, system_time_zones())) { - $target_user->{$target_element} = $value; - } - else { - $target_user->{$target_element} = NULL; - } - } } diff -u b/tests/feeds/users.csv b/tests/feeds/users.csv --- b/tests/feeds/users.csv +++ b/tests/feeds/users.csv @@ -3,4 +3,4 @@ -Fester,fester@example.com,1241865600,fest,c8cce3815094f01f0ab774fd4f7a77d4,$S$DjJPqmjlWTIen0nQrG3a.vA71Vc0DqCpKuB.g9zmBMnGzIV6JxqH,Europe/Lisbon -Gomez,gomez@example.com,1228572000,gome,8a5346b9a510f1f698ab0062b71201ac,$S$Dv.EtHlTfnrxuWGLbe3cf31mD9MF6.4u2Z46M2o2dMGgQGzi7m/5,utc +Fester,fester@example.com,1241865600,fest,c8cce3815094f01f0ab774fd4f7a77d4,$S$DjJPqmjlWTIen0nQrG3a.vA71Vc0DqCpKuB.g9zmBMnGzIV6JxqH, +Gomez,gomez@example.com,1228572000,gome,8a5346b9a510f1f698ab0062b71201ac,$S$Dv.EtHlTfnrxuWGLbe3cf31mD9MF6.4u2Z46M2o2dMGgQGzi7m/5,Europe/Lisbon Wednesday,wednesdayexample.com,1228347137,wedn,fefb673afaf531dbd78771976a150dc8,$S$DdPzksGh/c8UukipWagAhTzaqUp/eNHVPiC.x6URBQyA503Z41PI,America/New_York -Pugsley,pugsley@example,1228260225,pugs,09189568a8ee4d0addf53d2f6e4847cd,$S$D1oUihjrYXr.4iesN8Sfw1rVRLdo188v0NRGgcNR/V09oIyYPYmZ,EuropeLisbon +Pugsley,pugsley@example,1228260225,pugs,09189568a8ee4d0addf53d2f6e4847cd,$S$D1oUihjrYXr.4iesN8Sfw1rVRLdo188v0NRGgcNR/V09oIyYPYmZ,utc diff -u b/tests/feeds_processor_user.test b/tests/feeds_processor_user.test --- b/tests/feeds_processor_user.test +++ b/tests/feeds_processor_user.test @@ -775,9 +775,9 @@ $account = user_load_by_name('Morticia'); $this->assertEqual('UTC', $account->timezone, 'Morticia has the UTC timezone.'); - // Assert that Gomez did not get any timezone. - $account = user_load_by_name('Gomez'); - $this->assertFalse($account->timezone, 'Gomez does not have any timezone'); + // Assert that Fester did not get any timezone. + $account = user_load_by_name('Fester'); + $this->assertFalse($account->timezone, 'Fester does not have any timezone'); } /**