Okay
  Public Ticket #3232211
Multiple users editing data
Closed

Comments

  • James Joy started the conversation

    We have been using WPDatatables for a number of years for clubs to register runners for a cross-country league.

    Whilst this works well, there is a practical issue that some clubs have more than one person doing this, so currently, they have to share the username and password, which results in various issues around forgotten passwords, etc.

    What we would like to do is allow several users to edit the records for their club only, so user1, user2 and user3, can only edit records for club A. Is this possible?

  •  1,708
    Miloš replied

    Hi, James 

    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.

    -

    We don't have an easy built-in feature to achieve limiting specific rows for a group of users,

    but there is a custom workaround that we can suggest.

    There is a workaround to add custom user roles,  then select a group of people that wil have that role,

    and then by making a custom SQL Query for a Table,  you can filter the rows to only show for specific user row.

    You could add custom user roles, through the Membership, and here is an example of a table.

    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.

    This is a custom solution, so we can only provide advise to get you started with this example,

    unfortunately, we are not able to fully build a solution for our users,

    as our support does not include writing SQL Queries.

    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