Skip Navigation

[Resolved] Control of creation of users (by the manager) by user roles, simulating a hierar

This support ticket is created 4 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Jamal 4 years, 8 months ago.

Assisted by: Jamal.

Author
Posts
#1626045

Control of creation of users (by the manager) by user roles, simulating a hierarchy

Hello,

I would like to know how to do a user creation control by user role, by the manager, simulating a hierarchy of users (low levels cannot edit higher levels) with the Toolset settings, or by code. If it is possible only with code, can you give me a direction?

Actually I tried to follow the instructions found on your website (which asks you to check an option in the Access settings), but it didn't work, and the users are configuring the correct functions (is it for the levels ability, correct? Level_0 to level_10)

Here is an example of functionality found in another plugin:
hidden link
Search the page for "Role Hierarchy".

I'm waiting

Thank you

#1626353

Hello and thank you for contacting the Toolset support.

Toolset Access plugin is the only plugin in our suite to handle access and permissions. Even though the plugin is feature-rich, there is no such feature such as "Role Hierarchy". I am also a bit confused, about what that will mean! If you elaborate more on your use case, I might give some directions to do it.

Regarding allowing some users to create other users, you can create different user forms, and configure each one to create a user with a specified role. Then you can control access to the form by role or other criteria that are configurable in Toolset Access.

I suggest to read our user guides and get back to me with any question regarding your use case.
https://toolset.com/documentation/user-guides/access-control/

#1629119

Hello good day...

I will describe what I need, I find it easier for you to understand:

suppose I have these types of user roles:

1 - Administrator
2 - Gold User
3 - Silver User
4 - Bronze User

I would like that to happen:

User: 1 - Administrator
Action: Can manage any type of users

User: 2 - Gold User
Action: Empower only types: 3 - Silver User and 4 - Bronze User

User: 3 - Silver User
Action: Empower only type: 4 - Bronze User

User: 4 - Bronze User
Action: Cannot manage any type of user

I created these types of users with the correct capabilities and still enabled "Do now allow users to view and modify other users with higher privileges" in Access options, but it is not working. Users can create and edit any type of user.

In the capabilities of users it looks like this:

all with: "list_users" and "promote_users"

and set the levels like this:

1 - Administrator: level_0 to level_10
2 - Gold User: level_0 to level_9
3 - Silver User: level_0 to level_8
4 - Bronze user: only level_0

I know that the capacities from level_0 to level_10 are depreciated, but I found another way to mark that one user is at a higher level than the other.

Did you get it?

How can I do this?

#1630953

Thank you 🙂 Now it is more clear.

You are right, the level_* permissions are deprecated and I do not think are used anymore. But In general, allowing this use case from the backend will not be possible with Toolset. It needs custom code.

But, creating a user management interface on the frontend is possible. Basically, it will be a view to list users, a form to create a user, and a form to edit a user.

Regarding forms, you will have to create a different for each role, configure each form to create the user with only the allowed roles. Both for user create for and user edit form.
- https://toolset.com/documentation/getting-started-with-toolset/publish-content-from-the-front-end/forms-for-editing/

Regarding the view, you can either create different views for Administrator, Gold User, and Silver User that will query users with the appropriate roles and display each one either using the conditions or the Access shortcodes:
- https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/
- https://toolset.com/documentation/user-guides/access-control/access-control-texts-inside-page-content/
The view will also display an edit link for each user and an add button. These links will redirect to the appropriate form.

I hope this makes sense. Let me know if you have any doubts.