members
members copied to clipboard
Reset default roles & capabilities
It would be awesome to have some way to reset the default roles and capabilities.
I haven't played too much with actually deleting a predefined role from wordpress (like removing the contributor role for example) but if someone were to do this (for any of the predefined roles) it would be really nice to be able to get that default role back. Again I haven't deleted a default role so I don't know if it's even possible (the plugin has a link that implies I can do it) or how that would affect everything, but it would definitely be good to have a reset option of some kind. Just thinking about it, I wouldn't imagine creating a new role with the right capabilities would not be exactly the same because the role ID wouldn't match and I don't know how important that is.
Something I have played with for sure is changing the capabilities of the default roles. In this case it would be great to be able to reset a role back to its defaults. Even better would be to also indicate which capabilities are default for that role when viewing the capability editor, as well as having an easy reset button. Of course custom roles wouldn't have default capabilities so they wouldn't need indicators about default capabilities, or a reset button (unless that button simply removed all capabilities, but that might be undesirable).
Thanks for reading!
:+1:
:+1: Agree, I would even gladly help with implementation ;)
I might be in favor a individual role reset for the core WP roles. That's the safest and least-damaging option.
Before going down that path, it would be useful to identify the reasons a user needs to reset. Are there things that can be done to avoid those issues?
One such issue is one that I just posted to add a warning notice when editing the administrator role: https://github.com/justintadlock/members/issues/98
I believe users need the way to safely restore the (core) role permissions, as it is easy to lose track which exactly permissions have been changed. Also, perhaps less experienced WP admins are likely to play around with the plugin and then uninstall it, hoping that it would restore everything on uninstall. But nope, documentation says "use at your own risk" :)
I would keep it as an option in Settings view, so that in never triggers automatically, but users have the option to cleanup in case if they want to install other user/role management plugins.
What do you think?
In my case it's easy, because I only changed one permission for Contributors, nothing else for now. But I'm sure I'll forget soon enough what I did :)
I think you should know what you're getting into before you start messing around with roles and caps. If that's a case of poor education on my part, we need to start by correcting that.
I would keep it as an option in Settings view, so that in never triggers automatically, but users have the option to cleanup in case if they want to install other user/role management plugins.
I wouldn't add it under Settings > Members. The user needs to understand the difference between a plugin setting and modifying core WP user roles/caps. I always try to explain that Members is merely a UI layered over existing WP functions.
All other role management plugins should work exactly the same under the hood. Otherwise, they are fundamentally broken. That's not a good reason for resetting. A user should be able to switch from one to another with no issue and no need to reset.
Ok, the only problem I see is that it's hard to remember (and hence, restore) all the default permissions for the core roles.
I do not insist though. It's totally clear to me how the plugin works. It's exactly the one I hoped to find. Thanks! ;)
It's pretty rare that I have a user come to me with a major need to reset their roles/caps.
The biggest in the past was when they accidentally deleted a role. The problem there wasn't a need for a reset link. The problem was that it was too easy to delete a role. So, I fixed that issue with an "Are you sure?" alert. That issue is pretty much nonexistent now.
So, that's why I like to identify the actual issue first before diving into resetting everything, which is more of an absolute last resort option that's best avoided.
The biggest thing I think would be very nice is some kind of highlighting or visual cue to indicate which privileges are enabled by default when editing a system role. And if it's going that far I don't see the harm in having a button on that page that automatically selects those privileges and de-selects any that are not default, then allow the user to click submit to confirm the changes were intentional.
The only explanation I have for why recreating a system/default role after deletion would be handy is because there are times (although rare) when a user might feel they absolutely do not want specific roles to exist on their site but then reconsider later and would like a way to get them back. This is much less of something that happens on accident or happens due to lack of documentation and more likely to happen if a site owner changes the way they run the site (maybe adding more staff to the site or something).