[wp-trac] [WordPress Trac] #46035: Add set_display_name method to WP_Roles class
WordPress Trac
noreply at wordpress.org
Fri Jan 18 13:44:45 UTC 2019
#46035: Add set_display_name method to WP_Roles class
-------------------------+-------------------------------------------------
Reporter: | Owner: (none)
dingo_bastard |
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Users | Version: trunk
Severity: normal | Keywords: needs-patch dev-feedback 2nd-
Focuses: | opinion
-------------------------+-------------------------------------------------
Currently, people are following tutorials on line on how to 'change' the
display name of certain user roles in WordPress, by basically overwriting
the name property every time on either `init` or `admin_init` hook.
This is total overkill, and a hacky way to change the role display name
(not role name which governs the capabilities stored in the database).
If there was a method `set_display_name` (and a corresponding getter
`get_display_name`) this cosmetic change could be done only once on plugin
activation - this change would then be permanent in the database and you
wouldn't need to run the 'rewrite' all the time just to change name
(Editor to Blog Editor for instance, or Administrator to Operations).
Only way, to do this now is to copy the entire `WP_Role` object, then
remove the original one, change one property and add a 'new' role.
This feels super hacky to me.
Thoughts, opinions, suggestions?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/46035>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list