Fix permissions for users role

I have 4 users roles on my WordPress platform (role1, role2, role3, role4)

  • Role 1 : administaror (full acces)
  • Role 2 : proposal_editor (can create and publish posts, pages, templates, users...)
  • Role 3 : proposal_author (can create and publish posts, pages, templates and users of the same level or below)
  • Role 4 : proposal_viewer (can only see a specific pages and posts on front-office no access to back-office)

Right now the user with Role 3 can create Role2 Role3 and Role4 users. I need to make him able to create only Role3 and Role4 users.

What can i add to function.php to do that?

Also a need for Role 3 to see only Role3 and Role4 users on the users list (no role1 and role2).

Thanks in advance.

Topic listing user-roles permissions users Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.