Okay
  Public Ticket #3197177
How to allow a user to view data from a small group of other users
Closed

Comments

  • kim wiil started the conversation

    Another function we are looking for using wpdatatable. 

    We have clients that have many locations, where we will need a login for each location. That's part is done. 

    But how do we create users that can view other locations' collections? 

    Like how can a user be created, so this user can view data from a small group of other users?

    Example: 

    ID 10 can view data from ID 11, 12, 13, 14, 15, 16, but not edit, delete, new entry?

  •  1,708
    Miloš replied

    Hi, kim 

    Thanks for reaching out to us

    To be honest, i believe that something like this is not possible with the current plugin's built-in possibilities,

    but i will double-check with our 2nd level Team to see if we have any workaround to offer you at this time.

    Thank you for your patience, we will report back as soon as they check and advise

    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

  •  1,708
    Miloš replied

    Hi, kim 

    Sorry about this, actually i remembered a workaround we have.

    It is maybe not ideal for your use- case,  since you wish to set up a group of user ID's as a small group,

    but, let's say if you add this group of users as Members to your site,

    and if you add a Custom User Role to that group of users either by "User Role Editor" plugin,  or a Membership plugin.

    Then you could use the "user role" for filtering, then only the users that have this "role" will be able to see these rows.

    -

    There is no easy built-in feature to achieve filtering per user role,

    but i will share a custom workaround with you.

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

    This example is by using "default user roles", but the same principle can be used for Custom Roles.

    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.

    -

    And important to note, this is a custom workaround, so we can only give you examples to get you started,

    but our support does not cover troubleshooting of custom solutions,  or writing/debugging custom SQL Queries for users.

    -

    If you wish to see an easier built-in solution/feature for this use-case, you can ad a future improvement suggestion for us.

    Please feel free to search on our suggestions page

     to see if someone may be already suggested this feature. If you can't see it, feel free to add your suggestion there,  and as more people vote, the feature will move higher on the priority list.

    You can certainly follow our changeLog page if you'd like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;

    and our newsletter, so you're informed about new features, bug fixes, freebies, etc.

    -

    We hope this helps.

    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