[email protected]
Forum Replies Created
-
Forum: Networking WordPress
In reply to: multiple roles for a userGlad we finally got on the same page. I’d like to add a bit more info to possibly complicate things even more. Continuing to look at the functions available in the WP_User class there is an option to add a capability directly to a user.
I know the traditional model is to think of giving capabilities to a role, and then assign a role to a user, but again, why would there be functions is core to add a capability directly to a user, if this isn’t how it should be done.
Forum: Networking WordPress
In reply to: multiple roles for a userAs an additional reference, although not an official WP reference, check out The Ultimate Guide to Roles and Capabilities. The best way to find the relevant reference is to do a search on that article for “multiple”. There is only one reference, so it should be easy to find.
In case in the future the article is unavailable, here is an excerpt:
WP_User class
This class lets you manage roles and capabilities per user, which means you can assign multiple roles to a particular user, or add a capability to a certain user regardless of his current role.Forum: Networking WordPress
In reply to: multiple roles for a userYou missed the target again. Look a bit deeper in the source code(https://core.trac.www.ads-software.com/browser/tags/3.0.4/wp-includes/capabilities.php) and you’ll notice more than one function called add_role. In the WP_USER class there is a function called add_role. This is the one I’m referring to.
This is a function to adds an additional role to the selected user for the given site. So, if I use the add_role function you are referring to, and create a “Trusted Author” role, and can then assign this role, in addition to the standard “Author” role to a user.
I’m not advocating that you should do this, I’m just illustrating that the functionality exists to do this within the constructs of wordpress functions. So, if they didn’t intend on this, why create the function to perform this action. Why not enforce the one role per user per site, which the set_role function inside the WP_User class does.
Forum: Networking WordPress
In reply to: multiple roles for a userActually, I think you aren’t quite understanding all of the WP functionality. Each user is allowed multiple roles per site. If you look at how the function $user->add_role() works, it doesn’t ask for a site. If WP was to restrict a user to one role, why would they create a function that allows the you to add additional roles to a user for a given site.
There is a separate function $user->set_role(), that enforces only one role per user per site, but why have the add_role() if multiple roles aren’t a supported feature.
Forum: Networking WordPress
In reply to: Network Option > can’t uncheck add new users optionCan anybody confirm if this was fixed in 3.0.1. I just installed in on a development server and it appears to be working. I looked at all the trac tickets for 3.0.1 and didn’t see anything that referenced this issue.
I guess I’m just curious if it was fixed by design, or by accident. I guess either way it’s good that it’s working.