Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Beta phase evaluation
Issue category | Bug |
---|---|
Issue priority | Notmal |
Prioritized changes | The main goal of this issue is usability |
Steps to reproduce:
1. Set user status to blocked
2. Go to user edit form
3. Notice that the user status radio buttons are not showing any status
I believe this is because the value for 'blocked' is 0.
I can see this issue in latest 8.x version. See the screen below.
Comment | File | Size | Author |
---|---|---|---|
#9 | user_edit_form_status-2513576-9.patch | 2.12 KB | willzyx |
#7 | Blocked_User_Status.png | 27.59 KB | manauwarsheikh |
#5 | user_edit_form_status-2513576-5.patch | 2.19 KB | willzyx |
#5 | user_edit_form_status-2513576-5-test-only.patch | 1.43 KB | willzyx |
#2 | user_edit_form_status-2513576-2.patch | 588 bytes | willzyx |
Comments
Comment #1
zakir.gori CreditAttribution: zakir.gori as a volunteer and commentedComment #2
willzyx CreditAttribution: willzyx commenteduser status, used as #default_value in the radio element, is checked using \Drupal\user\UserInterface::isActive() which return a boolean.
Comment in \Drupal\Core\Render\Element\Radios::processRadios() say:
this is a little weird..if user account is blocked (status == FALSE) the default value is not considered
Comment #3
masipila CreditAttribution: masipila commentedReviewed and succesfully tested.
@willzyx, regarding your wondering. I believe that the documentation is correct.
Thanks for a quick patch!
Cheers,
Markus
Comment #4
willzyx CreditAttribution: willzyx commentedI think we need some tests..
Comment #5
willzyx CreditAttribution: willzyx commentedComment #7
manauwarsheikh CreditAttribution: manauwarsheikh commentedWhat: Verified for Blocked user's status.
Result: "Blocked" status is appearing for the blocked user)screenshot attached).
Comment #8
alexpottNice test coverage.
I think rather than doing the cast to int we should just use $account->get('status') instead of $account->isActive().
That way if the status system is extended by contrib to have other values they need to change less.
Comment #9
willzyx CreditAttribution: willzyx commentedAddressing #8 but I don't think it is a real improvement. I think that if we want to allow contrib modules to extend status system in a comfortable way we should add getter and setter methods for status in user entity and create constants for active and blocked statuses. Currently we use (at least in AccountForm) a fragile (positional) logic for the management of this attribute
Comment #12
willzyx CreditAttribution: willzyx commentedfailures seem unrelated to this issue, retesting
Comment #14
googletorp CreditAttribution: googletorp as a volunteer and at Reveal IT commentedThe patch looks good. It has
• A failing test only patch
• A combined patch that fixes the test
• Code is clean and all is good.
Comment #15
googletorp CreditAttribution: googletorp as a volunteer and at Reveal IT commentedAdd beta evaluation.
Comment #16
alexpottCommitted efeb597 and pushed to 8.0.x. Thanks!
Thanks for adding the beta evaluation.