Okay
  Public Ticket #3056563
Questions about about users only having access to their data.
Closed

Comments

  • Roy started the conversation

    I saw your tutorial video where it was shown how to configure the table such that users can only access their own data in a shared table.

    User A has access to Data A.

    User B has access to Data B.


    My question is: Is it possible for a group of two or more users to have access to just their data and a different group of users to have access to just their data?

    Users A & B have access to Data AB.

    Users C & D have access to Data CD.

  •  1,819
    Miloš replied




    Hi, Roy 

    Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.

    -

    That is correct, we have the built-in feature for users to view and edit only their own data, based on user ID; as you saw on the video, we also have this documentation on it.

    That goes for editable tables;

    for non-editable we have a bit more customized workaround, based on user ID.

    -

    Now, for several people/ or a group to have access to certain data, that can be achieved.

    We have an example, i will show you, and i hope that will help to get you started in the right direction.

    -

    If the dependency is a user role, for example, we could make it work.

    If I have this table:

    5458776907.png

    This is a manual table which has manually entered IDs from wp_users and roles from wp_usermeta:

    7855603551.png
    6462766399.png
    7686895681.png

    So, then I go to create an SQL query based table which will display entries based on user roles using this query:

    SELECT  new_table.id AS ID,        new_table.role AS Role,        new_table.product AS Product,        new_table.amount AS Amount
    FROM wp_wpdatatable_6 AS new_table
    JOIN wp_usermeta AS new_table_1
    ON new_table_1.user_id = %CURRENT_USER_ID%
    AND new_table_1.meta_value LIKE CONCAT('%', new_table.role, '%')
    

    When I'm logged in with user ID = 1, I see this:

    9999185249.png

    When I'm logged in with user ID = 4, I see the same thing. And when I'm logged in as one of the subscribers, I can only see the rows where role = subscriber:

    2907856651.png

    The only difference is that as subscriber I don't have access to back-end, so this confirms it is working on both front and back.

    So, we're only left with hiding unnecessary columns, adding names, and so on.

    Hope this helps.

    -

    And, just wanted to point out that we have a Demo Sandbox site, where you can try out some of the functionalities, on this link

    and there is a 15-day money-back guarantee period, So if you purchase the plugin, you can safely fully test it out, and if it doesn't fit your needs you can request and receive a refund in that period. ( same goes for all plugins and add-ons)


    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables