Closed (outdated)
Project:
Drupal core
Version:
7.x-dev
Component:
user.module
Priority:
Minor
Category:
Task
Assigned:
Issue tags:
Reporter:
Created:
14 Feb 2007 at 15:39 UTC
Updated:
20 Mar 2020 at 16:52 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
ximo commentedI see now that one can't set an individual checkbox in a group of checkboxes as disabled with the current Form API, a patch is needed for this to be possible: http://drupal.org/node/104715
I support that patch however, and think it should be part of the Forms API. Would be useful in many situations for module developers, and in this case in user.module..
Comment #2
ximo commentedCombining the attached patch with the patch found here: http://drupal.org/node/104715, I made it work. The attached patch doesn't remove the 'authenticated users' checkbox from the Roles list (as the original code does), instead it disables it (using the patch linked to earlier) and adds its default value of TRUE. I also changed the description from saying "and all roles" to "and other roles", I found it better to keep the description. Easy!
Not sure this is something people will find useful, but it was a good practice for me, being my first patch and first hack into Drupal core. Needed to start somewhere :)
Along the way I also came up with another idea; it would be nice with a setting that hides all descriptions from all forms, as with the help texts. Hm...
Comment #3
gaele commented+1. It follows the KISS rule.
Comment #4
dries commentedA screenshot maybe? It helps to show this to the others ... :)
Comment #5
ximo commentedI realize now that this really is nitpicking, but maybe somebody else will find it worth doing? Generally, I think explaining something in a visual way is much better than explaining it in text. An example of this is this very issue, I should've included the screenshot right away.
Nuff talk, see the before/after shots in the attached file.
(Don't mind the muted sound OSD that got into the screenshot, I closed Photoshop before noticing it, and didn't feel like opening it again just to remove it.)
Comment #6
Gurpartap Singh commentedYour patch disables them all. Rest seems fine.
Comment #7
panchoI like this very much, and this is a must-have, not just a nice little feature. In fact, I think this is a usability bug, as the 'authenticated users' has been (automatically) assigned to the user, but is concealed from the admin.
Still, Gurpartap is right: Your patch in #2 disables all checkboxes.
This is because you assume the FormAPI extension in #104715 to be committed. Unfortunately this has been definitely postponed to D7.
After some fiddling I came up with a solution for D6 that doesn't rely on the FormAPI extension. It doesn't exactly result in beautiful code, but it's the only way to do it right now. This demonstrates how much that small FormAPI extension is needed to produce lean code.
Okay. But the good news is: it finally works, tested well and makes the behavior of roles more intuitive. No string changes involved.
Remember that this should (and can) be changed to nicer code in D7, as soon as #104715 has been committed.
Comment #8
ximo commentedThanks for picking this up again, I had totally forgotten about this issue :)
There is a string change in your patch though, my guess is that it snuck in from my earlier patch. The attached patch (alt #1) sets the string back to its "frozen" state. The other patch (alt #2) removes the description string alltogether, as the checkboxes are pretty self-explanatory.
Other than that, the patch looks great. The way it's done is somewhat hackish, but obviously the best we can do at the moment. And it works.
Comment #9
panchoOops, I overlooked that... I'd let the string in, we can change it for D7, when we have to touch that code again, anyway...
Comment #10
ximo commentedAnybody care to comment on this? It would be nice to have this fixed for Drupal 6, as it is pretty bad usability..
I'd go for Alt #2, without the string. The checkboxes tell it all anyway.
Comment #11
gábor hojtsyLuckily it is not a string freeze violation to *remove* strings. To add is a violation and to modify is an evil violation.
Comment #12
ximo commentedThat's good, let's go for alternative 2 then. To recap, alternative 2 in comment #8 does this to admin/user/user/create:
- Adds a disabled "authenticated user" checkbox to the list of roles
- Removes the description "The user receives the combined permissions of the authenticated user role, and all roles selected here."
I believe it uses standard Forms API structure, and the HTML produced is all good.
This is a simple change, and by removing a long sentance and introducing a visual indicator instead, it's easier to understand and much clearner. Small fix, noticable difference. See this illustration for before/after shots.
I think this needs more feedback before it can be committed, so please comment :)
Comment #13
pancho+1 This is great! What else should I say? It works. And it improves usability a lot. RTBC.
After committing please keep open! After #104715 has been committed to D7, we can simplify the usage of FormAPI.
Comment #14
panchoWe still need some feedback, please!
Comment #15
gábor hojtsyWell, make sure to add a code comment on the unusual (re)use of the 'checkboxes' form API construct. If I understand it right, you are adding a subelement to the form item, which will be part of the list of generated elements for that checkbox list. If this gets documented right, this looks like a good UI improvement.
Comment #16
panchoDidn't apply anymore. Rerolled with a much more detailed code comment on this rather unusual FormAPI usage.
If the comment is not too long now, I guess it should be RTBC.
Comment #17
ximo commentedI added a TODO comment instead of the last line, so that IDEs will pick this up. I also referenced this issue instead, as we can't be sure the other issue actually will be relevant. This issue will provide background information and links to other relevant issues.
Other than that - RTBC if Gábor approves, and thanks for the help with this Pancho :)
Comment #18
ximo commentedRerolled for HEAD, this one should work!
Comment #19
gábor hojtsyThanks, committed.
Comment #20
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #21
panchoReopening this for D7. The rather ugly workaround should be replaced by more straight-forward code, after #104715 has been committed to HEAD (D7). I will post a patch after that has happened.
Comment #22
sutharsan commentedMoving all usability issues to Drupal - component usability.
Comment #23
aspilicious commentedNot relevant anymore...
Comment #24
David_Rothstein commentedComment #21 was (and is) definitely still relevant - the ugly workaround is still there. However, it looks like that issue has been moved to #284917: Allow FAPI select, radios, and checkboxes to specify some options as disabled. I'll leave a comment there to make sure it fixes this code as part of that patch.
Moving this issue back to 6.x and leaving it closed.
Comment #25
panchoNope, this belongs to the 8.x queue. The underlying FAPI-deficiency (#284917: Allow FAPI select, radios, and checkboxes to specify some options as disabled) is unfortunately still not solved. It might be backported to 7.x afterwards.
Comment #26
David_Rothstein commentedThere's really no reason to keep two issues open for the same thing, and the original bug here was fixed long ago.
Let's mark it postponed if you must leave it open, though. But I think it will be fixed just fine by the other issue.
Comment #27
panchoIt turns out this always has been possible.
So here's a followup removing the cludgy workaround.
Comment #29
panchoAnother try
Comment #31
panchoOh my goodness.
If it's the "missing newline" bug that I keep running into, then this patch should work fine even for the picky testbot:
Comment #32
panchocurrently a minor task
Comment #33
thedavidmeister commentedThis is now where discussion about options is happening #342316: Introduce proper Form API #types for 'option' and 'optgroup', and make #options consistent..
Patch no longer applies:
error: core/modules/user/lib/Drupal/user/AccountFormController.php: No such file or directory// Special handling for the inevitable "Authenticated user" roleComment needs a full stop at the end.
Really though, shouldn't followups be their own issues? I'd be tempted to re-close this if there wasn't a patch waiting.
Comment #34
camprandall commentedI'll look into re-rolling this.
Comment #35
stefank commentedRe-rolling the patch from #31.
Comment #36
stefank commentedwrong patch
Comment #37
stefank commentedSorry, submitted the wrong patch. Second one works.
Comment #38
sutharsan commentedThe comment is not indented and does not end with a period. Pls correct this.
Comment #39
stefank commentedCorrected, Thanks.
Comment #40
stefank commentedTriggering testbot.
Comment #41
sutharsan commentedComment #42
alexpottCommitted 945ed20 and pushed to 8.0.x. Thanks!
Comment #44
legovaerCreating back port
Comment #45
legovaerBackported & tested on 7.34
Comment #47
legovaerUpdating version to 7.x-dev in order to test my backport.
Comment #49
dcam commented#45 looks good to me. The code changes are almost completely identical to what went into D8. The HTML generated doesn't seem to have changed at all either.
Before:

After:

I'll RTBC it.
Comment #52
dcam commentedComment #53
David_Rothstein commentedHm, I'm not sure we should do this in a stable release.
It's certainly the "right" thing to do, but the user account form is something people heavily form-alter, and in this patch we are changing the data structure (granted only a little bit, but still changing it in a way that could break something).
Given that it's not a functional bug (as far as I understand), just a code cleanup, maybe we shouldn't bother?
Comment #55
csakiistvanBackported & tested on 7.44