Role based User display in backend - Core hack (1 post)

  1. hi2u_amit
    Posted 5 years ago #

    Dear all,

    I have customized Buddypress to build a simple "Proof of Concept" for a consulting platform.

    My site has 4 different roles for users.
    Admin, Client, Manager, Customer

    The Admin can create any number of Client Accounts.
    The Client in turn can create accounts for his own Managers and Customers.
    The Managers and Customers never see the backend.

    I want the Admin to be able to see all users of the system (default WordPress functionality). But the Client should only be able to see users created by him/her.

    To achieve this I am planning to create a new field called created_by_user in the wp_users table where I store the ID of the currently logged in User, who is creating this new User.

    I then intend to filter on the basis of created_by_user field to display appropriate entries in the backend.

    I have two questions:-
    1. Is this a good approach or are there better ways of doing it?
    2. How can I save this new field in the DB. (Despite an hour of trying, I haven't been able to comprehend how a new user is getting saved from user-new.php

    Thanks in advance for helping out!!

Topic Closed

This topic has been closed to new replies.

About this Topic