Commit efeb5971 authored by alexpott's avatar alexpott

Issue #2513576 by willzyx, manauwarsheikh, zakir.gori, masipila: User edit...

Issue #2513576 by willzyx, manauwarsheikh, zakir.gori, masipila: User edit form status radio buttons empty if user status is blocked
parent 6a8c02d5
......@@ -190,11 +190,11 @@ public function form(array $form, FormStateInterface $form_state) {
}
}
if ($admin) {
$status = $account->isActive();
if ($admin || !$register) {
$status = $account->get('status')->value;
}
else {
$status = $register ? $config->get('register') == USER_REGISTER_VISITORS : $account->isActive();
$status = $config->get('register') == USER_REGISTER_VISITORS ? 1 : 0;
}
$form['account']['status'] = array(
......
......@@ -85,6 +85,27 @@ function testUserEdit() {
$config->set('password_strength', FALSE)->save();
$this->drupalPostForm("user/" . $user1->id() . "/edit", $edit, t('Save'));
$this->assertNoRaw(t('Password strength:'), 'The password strength indicator is not displayed.');
// Check that the user status field has the correct value and that it is
// properly displayed.
$admin_user = $this->drupalCreateUser(array('administer users'));
$this->drupalLogin($admin_user);
$this->drupalGet('user/' . $user1->id() . '/edit');
$this->assertNoFieldChecked('edit-status-0');
$this->assertFieldChecked('edit-status-1');
$edit = array('status' => 0);
$this->drupalPostForm('user/' . $user1->id() . '/edit', $edit, t('Save'));
$this->assertText(t('The changes have been saved.'));
$this->assertFieldChecked('edit-status-0');
$this->assertNoFieldChecked('edit-status-1');
$edit = array('status' => 1);
$this->drupalPostForm('user/' . $user1->id() . '/edit', $edit, t('Save'));
$this->assertText(t('The changes have been saved.'));
$this->assertNoFieldChecked('edit-status-0');
$this->assertFieldChecked('edit-status-1');
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment