Opened 8 years ago
Last modified 4 months ago
#43885 new enhancement
WP_Role and WP_Roles::get_role() missing Display Name
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Role/Capability | Keywords: | dev-feedback has-patch needs-testing |
| Focuses: | Cc: |
Description
Hello,
While working with roles I found it odd that you can add a Display Name for a role but the WP_Role class and the WP_Roles function get_role don't provide this information.
Please add $display_name as a public attribute of WP_Role so it's available on that object and would be returned in the get_role function.
Thank you
P.S. Currently to access this information you have to use the WP_Roles as follows;
<?php $wp_roles->roles[$role]['name'];
Attachments (2)
Change History (6)
#2
@
7 years ago
Similar issue with different solution: https://core.trac.wordpress.org/ticket/34608
#3
@
5 months ago
- Keywords needs-testing added
Hey Everyone,
I have just taken a look into this, and it appears that the patch is causing an infinite loop which is caused by calling the WP_Roles class within the WP_Role class. As of such I have tweaked the patch to work using the global $wp_roles; variable instead.
I do feel like adding the display name to the WP_Role class is a long overdue feature, and it is somewhat odd how differently this class is set up compared to others within the codebase. Hopefully with this refreshed patch, and someone from the community confirming this is now working as intended, we can get this change into core soon. 😃
Add $display_name property to WP_Role class