Skip Navigation

[Resolved] Hierarchical users

This support ticket is created 5 years, 1 month 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#1373829

Tell us what you are trying to do?

Hello,
I would like to know how to create a hierarchy of WordPress users. I explain myself with a simple use case:
- There are several (WP) users who access the platform (Website) -> set up data partitioning and access restriction (it's simple at the moment)
- I am a user (WP user) of type "Enterprise" (there are others, with their accounts and their data)
- I want to be able to add (WP) users, who are related to me and to my data, and who have specific roles:
-----> HR Manager: he can in turn add (WP) users of type "Trainers"
-----> Training Manager: he can create "Training"
-----> "Trainers" can create "Training Sessions"

You can imagine this as a marketplace, with store managers, who in turn have department managers.

How to do this correctly? Please note (important) that we are only talking here about the implementation part of the user hierarchy. For the interfaces we develop from scratch.

Thank you !

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?

#1373937

Hi, let's assume you plan to use front-end Forms to register new Users. In this case, you can set up individual Forms that create new Users in a single specific role. Then you can use Access Control shortcodes to show and hide those individual Forms based on the current User's role. So for example, let's say you create an HR Manager User. When that User logs in, you will display a Form that creates Trainers on their homepage. However, when a Trainer logs in, that Form will not be displayed on their homepage because the Access Control shortcode prevents it. We have more information about Access Controls here:
https://toolset.com/documentation/user-guides/access-control-texts-inside-page-content/

Is that what you had in mind? Or are you looking for a way to implement this type of control in the wp-admin side of things?

#1375301

Hi, thanks for your answer!

My main "problem" is "how to link the (WP) user who is an HR Manager to the (WP) user who is the Company (Manager) the right way in WP and Access Control" in order to limit access to the informations of the concerened company (let assume other WP accounts like "Trainers", and Custom Posts like "Trainings" for example), while there are other companies with the same structure and their own informations, in a kind of Marketplace ?

I'm not talking about screens (we develop the frontend with a third component), but about Access Control.

Thanks again !

#1375653

Okay I see, unfortunately in neither Access nor WordPress is there a concept of hierarchical Users or "departments" built-in. In general, Access works based on applying restrictions per User role. So in theory you could create similar custom roles for each company or department:
Company/Department 1 Roles: HR Manager 1, Company Manager 1, Trainer 1, etc.
Company/Department 2 Roles: HR Manager 2, Company Manager 2, Trainer 2, etc.
...and so on for each Company/Department. Your site admins would use those individual roles to create restriction rules for content. For example, admins would create a Post Group to apply to all Company 1 posts, and would set restriction rules for that Post Group based on the User roles mentioned above.

Your content creators would be responsible for setting the appropriate post groups for their content, so that Access restrictions are applied correctly. In other words, restriction of content is not automatically imposed based on the creator's role or department. The content creator must manually choose a post group and apply that post group to the content s/he creates - I wanted to be clear about how this process would work with Access.

I hope this helps explain how Access works. Let me know if you have follow up questions.