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.
Problem/Motivation
In the URI "/admin/people", I found a Action dropdown for user list. There are the following options-
1. Add the Administrator role to the selected users
4. Remove the Administrator role from the selected users
Proposed resolution
I think we can replace the "users" to "user(s)" for above options as others options (see attachment).
Comment | File | Size | Author |
---|---|---|---|
#39 | Screen Shot 2017-04-19 at 3.29.06 PM.png | 48.07 KB | faline |
#37 | Can-we-modify-dropdown-options-for-User-list-2861072-36.patch | 1.01 KB | lomasr |
#37 | after.png | 95.86 KB | lomasr |
#37 | before.png | 105.85 KB | lomasr |
#34 | Edit | Drupal 2017-04-13 10-15-54.png | 60.64 KB | Gábor Hojtsy |
Comments
Comment #2
imrancluster CreditAttribution: imrancluster commentedHere is a patch. I have tested in my local environment. This patch will be applied after new installation.
Comment #3
imrancluster CreditAttribution: imrancluster commentedComment #4
saurabh rawat CreditAttribution: saurabh rawat as a volunteer commentedI have already tested this but it's not working even after clearing cache.
Comment #5
imrancluster CreditAttribution: imrancluster commented@saurabh rawat, If you apply the patch correctly then you have to reinstall your drupal site using updated code base. After that you will be able to see the changes.
Comment #6
saurabh rawat CreditAttribution: saurabh rawat as a volunteer commentedYou mean update.php or clearing cache will not work, I have to create new database and reinstall site.
Comment #7
imrancluster CreditAttribution: imrancluster commentedYes, after applying the patch, you have to create new database and reinstall site.
Comment #8
saurabh rawat CreditAttribution: saurabh rawat as a volunteer commentedafter reinstalling it is working but I don't think that it is right way as if someone is having drupal 8 site and S(he) wants to upgrade the version then they are not going to reinstall the site and change the database.
Comment #9
imrancluster CreditAttribution: imrancluster commented@saurabh rawat , I agree with you. Lets wait for senior advice. I am still learning Drupal 8 :)
Comment #10
cornelyus CreditAttribution: cornelyus commentedHi all,
A cache clear won't be enough on this case, because the label for administrator is actually saved in Database, "config" table with name "system.action.user_add_role_action.administrator".
Maybe a hook_update_N along with the label path, this could be done.
Comment #11
cornelyus CreditAttribution: cornelyus commentedTried to upgrade the label on hook_update_N, seemed to work in my tests.
Comment #12
tar_inet CreditAttribution: tar_inet as a volunteer commented#11It doesn´t work for me, you forgot to add the previous patch to yours. So , when a new role is added the option is still wrong.
Before applying #11
After applying #11
I merged both patched into one
Comment #13
renatogHi people
I applied the patch and the result is:
Zoom:
Good Work and Good Week.
Regards.
Comment #14
renatogComment #15
renatogComment #16
cornelyus CreditAttribution: cornelyus commentedYou're right @tar_inet .. i forgot to merge the 2. The patch I provided was for the exception situation reported before that it wouldn't change label for "old" roles.
Comment #17
tar_inet CreditAttribution: tar_inet as a volunteer commented#13 @renatog did you run the update.php? It looks like you haven´t.
Comment #18
tar_inet CreditAttribution: tar_inet as a volunteer commentedComment #19
renatogHi people.
You are right @tar_inet
After run update.php works good for me. Follow screenshot with result.
Thank you very much for yours contributions guys.
Good Work.
Regards
Comment #20
cilefen CreditAttribution: cilefen commented+1 for adding consistency to core! This issue needs a new title that explains the task succinctly because it becomes the commit message.
This comment will be a bit unclear when updates are executed. Is the update hook adding user(s) or "user(s)" to the dropdown option? I know the answer but I can imagine confusion. I think the dropdown can be referred to as "user actions". Why is "User" capitalized? Take a look at other hook_update_n comments for inspiration.
This comment isn't really necessary and neither is the variable. The same applies to the following comment and variable.
We use the new array syntax now ;-)
It should be "Remove the @label role from..."
Comment #21
_Archy_ CreditAttribution: _Archy_ at PitechPlus commentedComment #22
tar_inet CreditAttribution: tar_inet as a volunteer commentedThanks @cilefen, I hope this changes are better now
Comment #23
cornelyus CreditAttribution: cornelyus commentedlooks good to me!
Comment #24
kporras07 CreditAttribution: kporras07 at Manatí commentedIt works :D Marking as RTBC
Comment #25
tstoecklerTrailing whitespace.
This should be a single line (but still less than 80 characters).
Comment #26
jansete CreditAttribution: jansete commentedAdded the patch.
Comment #27
tar_inet CreditAttribution: tar_inet as a volunteer commentedI messed it up, sorry. #26 @jansete patch looks good.
Comment #28
th_tushar CreditAttribution: th_tushar commentedAdded required proper comments.
Comment #29
tar_inet CreditAttribution: tar_inet as a volunteer commentedIt looks good to me.
Comment #30
jansete CreditAttribution: jansete commentedThis should be a single line (but still less than 80 characters).
#26 it's okay
Comment #31
renatogHi people.
#28 it's ok.
Good Work and Good Week.
Regards.
Comment #32
Gábor HojtsyHm, there is no guarantee that the configuration was created in the language that the update is running with, so this may break the strings in the configuration (make them appear in a different language then they should).
Also it is possible to customize this label isn't it? Why would we overwrite customized labels with our own?
Comment #33
cornelyus CreditAttribution: cornelyus commentedI was under the impression that a configuration label should always be first and foremost in English, and translatable.
I am not sure about if "it is possible to customize this label"
Comment #34
Gábor HojtsyYou can absolutely edit the action:
Forcibly updating the existing configured label to something else is IMHO not a good idea. If it was the same as the originally generated one, then *maybe*, but even then it might be best not to mess with the existing site IMHO.
Comment #35
cornelyus CreditAttribution: cornelyus commentedthanks for pitching in :) @gabor .. I see it now.
My 2 cents.. maybe then just patch with the first original patch that only changed the string, and didn't do an hook_update to the label.. this would bring consistency for the newly installed core D8 for that particular label, right?
Comment #36
Gábor HojtsyYeah I think so yes. There is also the problem of which language are these config entities getting created in but that is for another bug report :)
Comment #37
lomasr CreditAttribution: lomasr at gai Technologies Pvt Ltd for gai Technologies Pvt Ltd commentedI agree with Gábor, thanks for noticing. Applied the original patch in #2, it worked cleanly. Please see the screens. I am resubmitting the patch in #2 so that original patch comes on top.
Comment #38
lomasr CreditAttribution: lomasr at gai Technologies Pvt Ltd for gai Technologies Pvt Ltd commentedComment #39
faline CreditAttribution: faline at CI&T commentedI've tested and #37 is ok!
Comment #40
alexpottCommitted 4971d77 and pushed to 8.4.x. Thanks!
Funnily enough the actions aren't editable via the UI because #2605042: Cannot edit actions created by user_user_role_insert().
It's nice that these labels are not consistent with the other labels.
I'm crediting @saurabh rawat for testing the patch on existing sites and noting the lack of an upgrade path - even though there should not be an upgrade path it is always good to think about existing sites. I'm crediting @cilefen for the thorough review. I didn't credit @tstoeckler because their review was just very minor coding standards nits.
@kporras07 thank you for reviewing this issue! Just saying it works is not enough evidence for review credit. What we do need people to review is whether the issue has a correct scope, whether it passes the core gates, whether the solution completely fixes the problem without introducing other problems, and whether it's the best solution we can come up with. See the patch review guide for more information. When you do post a review, be sure to describe what you reviewed and how. This helps other reviewers understand why you considered the issue RTBC (and is considered for issue credit).