Opened 22 months ago
Last modified 11 months ago
#58103 reviewing enhancement
Show user roles when deleting users
Reported by: | Presskopp | Owned by: | audrasjb |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | |
Component: | Users | Keywords: | has-patch changes-requested dev-feedback has-screenshots needs-testing |
Focuses: | Cc: |
Description
When deleting an admin user, who has published something before, you will be asked to transfer the ownership of posts:
Attribute all content to:
Then there's a list with ALL users of the site, having all sorts of roles and therefore it can be huge.
My proposal is to somehow differenciate between user roles here so one can easily pick another admin.
Attachments (2)
Change History (39)
#2
@
22 months ago
- Keywords needs-patch added
It would make sense to me, but it looks like we'd need to change the underlying wp_dropdown_users()
function.
The easiest thing would probably be adding a value for the show
parameter to e.g. display Display Name (login_name) - role
.
A smarter and more versatile choice could be adding a bool group_by_role
parameter to display users grouped in one <outgroup>
for each role.
This ticket was mentioned in PR #4330 on WordPress/wordpress-develop by @madejtax.
22 months ago
#3
- Keywords has-patch added; needs-patch removed
Trac ticket:
This ticket was mentioned in PR #4331 on WordPress/wordpress-develop by @madejtax.
22 months ago
#4
Trac ticket:
#6
@
21 months ago
Hello @madejtax,
The patch is working as expected.
I left comments in the PR: https://github.com/WordPress/wordpress-develop/pull/4331
#7
@
21 months ago
Hi,
Tested the patch and the patch is working fine. https://github.com/WordPress/wordpress-develop/pull/4331
The user roles are visible in Attribute all content to dropdown.
Just noticed that: role is visible as rol
. I think it should be role
.
Reference: https://prnt.sc/DjdnLZwy274b
Thanks!
@hztyfoon commented on PR #4331:
21 months ago
#8
Looks like there are some coding standards issues
in the file changes. Can u fix them?
#9
@
21 months ago
Looks like the PR https://github.com/WordPress/wordpress-develop/pull/4331 is failing some coding standard tests.
#10
@
21 months ago
Sorry, I made the changes and they would already be in the corresponding branch.
https://github.com/madejtax/wordpress-develop/tree/Changes-when-deleting-a-user-ticket-58103
I need to create the pull request, currently github is giving me a bug, when I solve it I will make the pull request.
This ticket was mentioned in PR #4441 on WordPress/wordpress-develop by @madejtax.
21 months ago
#11
Trac ticket: #58103
#12
@
21 months ago
I have a problem with PHPCS, the case is that it is giving me an error in a line that has no problem...
https://github.com/WordPress/wordpress-develop/commit/2b6662ec7f8135de50716c78fa53b92322c3c7ac
As you can see, I've already had several pulls.... But it still gives the same problem
#13
follow-up:
↓ 14
@
21 months ago
Hi,
Test Report for patch - https://github.com/WordPress/wordpress-develop/pull/4441
Environment:
WordPress- 6.2
Device- Mac
Browser: Chrome
Expected Result: The user roles should be visible in Attribute all content to: dropdown while deleting the user ☑️
Screenshots:
https://prnt.sc/pQOJk5TG9vX2
However, @madejtax can we update the 'role' in dropdown to 'Role'. Make first letter capitalize.
Other than this rest looks fine to me.
Thanks!
#14
in reply to:
↑ 13
@
21 months ago
Modified, ready to implement
Replying to pooja1210:
Hi,
Test Report for patch - https://github.com/WordPress/wordpress-develop/pull/4441
Environment:
WordPress- 6.2
Device- Mac
Browser: Chrome
Expected Result: The user roles should be visible in Attribute all content to: dropdown while deleting the user ☑️
Screenshots:
https://prnt.sc/pQOJk5TG9vX2
However, @madejtax can we update the 'role' in dropdown to 'Role'. Make first letter capitalize.
Other than this rest looks fine to me.
Thanks!
@audrasjb commented on PR #4331:
20 months ago
#15
Closed in favor of #4441
#17
follow-up:
↓ 18
@
19 months ago
- Keywords changes-requested added; close removed
- Owner set to audrasjb
- Status changed from new to reviewing
The patch looks almost good to me, but I wonder why the username (slug) was removed?
Also I don't think we need to add the strings "User:" and "Role:". And if we want to keep these string, they should at least be translatable.
Please note that tomorrow is 6.3 beta 1. Without a patch ready to go we will probably move this to the next milestone, 6.4 :)
#18
in reply to:
↑ 17
@
19 months ago
What do you think of this second option?
Where do I show the user's name, slug and role?
Edit: Edit: I thought it was a bit silly to show the name instead of the slug, in the end when you have the user you already know what name he/she has.
Replying to audrasjb:
The patch looks almost good to me, but I wonder why the username (slug) was removed?
Also I don't think we need to add the strings "User:" and "Role:". And if we want to keep these string, they should at least be translatable.
Please note that tomorrow is 6.3 beta 1. Without a patch ready to go we will probably move this to the next milestone, 6.4 :)
This ticket was mentioned in PR #4703 on WordPress/wordpress-develop by @madejtax.
19 months ago
#19
Trac ticket:
#20
follow-ups:
↓ 21
↓ 22
@
19 months ago
Hey thanks for updating the patch @madejtax!
As there is not much time before 6.3 beta 1 I'd recommend to simplify the patch and to keep it as close as possible to the current behavior.
Here is what I suggest:
"Display Name (username) - administrator"
echo '<option value="' . esc_attr( $user->ID ) . '">' . esc_html( $user->display_name ) . ' (' . esc_html( $user->user_login ) . ') - ' . esc_html( $user->roles[0] ) . '</option>';
#21
in reply to:
↑ 20
@
19 months ago
Replying to audrasjb:
Make sure to use translate_user_role()
for displaying role names.
#22
in reply to:
↑ 20
@
19 months ago
Here is the change as they say commented
Replying to audrasjb:
Hey thanks for updating the patch @madejtax!
As there is not much time before 6.3 beta 1 I'd recommend to simplify the patch and to keep it as close as possible to the current behavior.
Here is what I suggest:
"Display Name (username) - administrator"
echo '<option value="' . esc_attr( $user->ID ) . '">' . esc_html( $user->display_name ) . ' (' . esc_html( $user->user_login ) . ') - ' . esc_html( $user->roles[0] ) . '</option>';
This ticket was mentioned in PR #4715 on WordPress/wordpress-develop by @madejtax.
19 months ago
#23
This ticket was mentioned in Slack in #core by chaion07. View the logs.
19 months ago
#25
follow-up:
↓ 28
@
19 months ago
- Keywords dev-feedback added
- Milestone changed from 6.3 to 6.4
Thanks!
However, I have a small concern about $user->roles[0] because on many websites, users can have several roles.
As per today's bug scrub and since WP 6.3 beta 1 is scheduled today, let's move this ticket to milestone 6.4 to give it more time for discussion/feedback.
#27
in reply to:
↑ 26
@
19 months ago
Replying to Presskopp:
I was even thinking of something like:
Nice, but then every WP_Role object, including custom ones, need a plural label for translation.
#28
in reply to:
↑ 25
@
19 months ago
Replying to audrasjb:
Thanks!
However, I have a small concern about $user->roles[0] because on many websites, users can have several roles.
Ordering them alpabetically will not work well for all languages, so I suggest keep it simple. But if not simple, indicate it. That means show first one, then suffix it with '(+n)' when necessary where n = count(roles).
And don't forget no role situation.
#29
@
17 months ago
@madejtax can you please look through the suggestions and concerns above? This is an enhancement and to land it into 6.4, it needs to be in Trunk before Beta 1. Thank you 🙏
#30
@
16 months ago
I wonder if a better approach will be to create a new function wp_dropdown_users_with_roles() instead of the current approach, this way it can be used elsewhere if needed. And patch cannot be applied, there are changes in wp_dropdown_users() arguments.
This ticket was mentioned in Slack in #core by oglekler. View the logs.
16 months ago
#32
@
16 months ago
- Milestone changed from 6.4 to 6.5
This ticket was discussed during bug scrub.
Due to lack of activity lately and some changes that needs to be done, I am moving it into the next milestone.
Add props to @mukesh27
This ticket was mentioned in Slack in #core by audrasjb. View the logs.
12 months ago
#34
@
12 months ago
- Keywords needs-testing added
As per today's bug scrub: we have a PR but it still needs some testing/refinement to make sure it works well with multiple roles.
related #15855