This is not a big issue, but I thought I'd mention it.

Although the 'Add user' form states "The user receives the combined permissions of the authenticated user role, and all roles selected here.", I believe one could avoid that sentence and tell the user in a more logical way. My suggestion is: Add a disabled, checked checkbox with the 'authenticated users' role name and remove the text below. Cleaner and easier to understand.

Comments

ximo’s picture

I 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..

ximo’s picture

Status: Active » Needs review
StatusFileSize
new1.35 KB

Combining 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...

gaele’s picture

+1. It follows the KISS rule.

dries’s picture

A screenshot maybe? It helps to show this to the others ... :)

ximo’s picture

StatusFileSize
new47.41 KB

I 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.)

Gurpartap Singh’s picture

Status: Needs review » Needs work

Your patch disables them all. Rest seems fine.

pancho’s picture

Title: Better way to say that new users will be assigned the 'authenticated users' role automatically » Usability: 'authenticated users' role is concealed
Category: feature » bug
Priority: Minor » Normal
Status: Needs work » Needs review
StatusFileSize
new1.79 KB

I 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.

ximo’s picture

Thanks 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.

pancho’s picture

Oops, I overlooked that... I'd let the string in, we can change it for D7, when we have to touch that code again, anyway...

ximo’s picture

Anybody 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.

gábor hojtsy’s picture

Luckily it is not a string freeze violation to *remove* strings. To add is a violation and to modify is an evil violation.

ximo’s picture

That'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 :)

pancho’s picture

+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.

pancho’s picture

We still need some feedback, please!

gábor hojtsy’s picture

Well, 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.

pancho’s picture

StatusFileSize
new2.18 KB

Didn'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.

ximo’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new2.15 KB

I 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 :)

ximo’s picture

StatusFileSize
new2.14 KB

Rerolled for HEAD, this one should work!

gábor hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

pancho’s picture

Version: 6.x-dev » 7.x-dev
Status: Closed (fixed) » Needs work

Reopening 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.

sutharsan’s picture

Component: user system » usability

Moving all usability issues to Drupal - component usability.

aspilicious’s picture

Component: usability » base system
Status: Needs work » Closed (fixed)

Not relevant anymore...

David_Rothstein’s picture

Version: 7.x-dev » 6.x-dev

Comment #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.

pancho’s picture

Version: 6.x-dev » 8.x-dev
Component: base system » user.module
Status: Closed (fixed) » Active

Nope, 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.

David_Rothstein’s picture

Status: Active » Postponed

There'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.

pancho’s picture

Status: Postponed » Needs review
Issue tags: +Needs backport to D7
StatusFileSize
new1.54 KB

It turns out this always has been possible.
So here's a followup removing the cludgy workaround.

Status: Needs review » Needs work

The last submitted patch, 284917-show_auth_user_role-followup.patch, failed testing.

pancho’s picture

Status: Needs work » Needs review
StatusFileSize
new1.54 KB

Another try

Status: Needs review » Needs work

The last submitted patch, 284917-show_auth_user_role-followup-29.patch, failed testing.

pancho’s picture

Status: Needs work » Needs review
StatusFileSize
new1.54 KB

Oh 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:

pancho’s picture

Title: Usability: 'authenticated users' role is concealed » Code cleanup: 'authenticated users' role
Category: bug » task
Priority: Normal » Minor

currently a minor task

thedavidmeister’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +Needs reroll

This 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" role

Comment 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.

camprandall’s picture

I'll look into re-rolling this.

stefank’s picture

Assigned: Unassigned » stefank

Re-rolling the patch from #31.

stefank’s picture

Assigned: stefank » Unassigned
Issue tags: -Needs reroll
StatusFileSize
new3.39 KB

wrong patch

stefank’s picture

Status: Needs work » Needs review
StatusFileSize
new1.59 KB

Sorry, submitted the wrong patch. Second one works.

sutharsan’s picture

Status: Needs review » Needs work
+++ b/core/modules/user/src/AccountForm.php
@@ -213,7 +201,12 @@ public function form(array $form, array &$form_state) {
+    );
+
+// Special handling for the inevitable "Authenticated user" role
+    $form['account']['roles'][DRUPAL_AUTHENTICATED_RID] = array(
+      '#default_value' => TRUE,
+      '#disabled' => TRUE,

The comment is not indented and does not end with a period. Pls correct this.

stefank’s picture

Corrected, Thanks.

stefank’s picture

Status: Needs work » Needs review

Triggering testbot.

sutharsan’s picture

Status: Needs review » Reviewed & tested by the community
alexpott’s picture

Status: Reviewed & tested by the community » Patch (to be ported)
Issue tags: +TCDrupal 2014

Committed 945ed20 and pushed to 8.0.x. Thanks!

  • alexpott committed 945ed20 on 8.0.x
    Issue #119038 by Pancho, ximo, stefank: Code cleanup: 'authenticated...
legovaer’s picture

Assigned: Unassigned » legovaer

Creating back port

legovaer’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new1.42 KB

Backported & tested on 7.34

Status: Needs review » Needs work

The last submitted patch, 45: 284917-show_auth_user_role-followup-42.patch, failed testing.

legovaer’s picture

Version: 8.0.x-dev » 7.x-dev

Updating version to 7.x-dev in order to test my backport.

Status: Needs work » Needs review
dcam’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -TCDrupal 2014
StatusFileSize
new29.45 KB
new29.59 KB

#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.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 45: 284917-show_auth_user_role-followup-42.patch, failed testing.

dcam’s picture

Status: Needs work » Reviewed & tested by the community
David_Rothstein’s picture

Status: Reviewed & tested by the community » Needs review

Hm, 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?

  • alexpott committed 945ed20 on 8.1.x
    Issue #119038 by Pancho, ximo, stefank: Code cleanup: 'authenticated...
csakiistvan’s picture

Backported & tested on 7.44

Status: Needs review » Needs work

The last submitted patch, 55: 284917-show_auth_user_role-followup-55.patch, failed testing.

  • Gábor Hojtsy committed ba5468e on 8.3.x
    #119038 by ximo, Pancho: user role editing usability: include disabled...
  • alexpott committed 945ed20 on 8.3.x
    Issue #119038 by Pancho, ximo, stefank: Code cleanup: 'authenticated...

  • Gábor Hojtsy committed ba5468e on 8.3.x
    #119038 by ximo, Pancho: user role editing usability: include disabled...
  • alexpott committed 945ed20 on 8.3.x
    Issue #119038 by Pancho, ximo, stefank: Code cleanup: 'authenticated...

  • Gábor Hojtsy committed ba5468e on 8.4.x
    #119038 by ximo, Pancho: user role editing usability: include disabled...
  • alexpott committed 945ed20 on 8.4.x
    Issue #119038 by Pancho, ximo, stefank: Code cleanup: 'authenticated...

  • Gábor Hojtsy committed ba5468e on 8.4.x
    #119038 by ximo, Pancho: user role editing usability: include disabled...
  • alexpott committed 945ed20 on 8.4.x
    Issue #119038 by Pancho, ximo, stefank: Code cleanup: 'authenticated...

  • Gábor Hojtsy committed ba5468e on 9.1.x
    #119038 by ximo, Pancho: user role editing usability: include disabled...
  • alexpott committed 945ed20 on 9.1.x
    Issue #119038 by Pancho, ximo, stefank: Code cleanup: 'authenticated...

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.