Okay
  Public Ticket #2976702
Creating tables where users see only their data
Closed

Comments

  • Ezekiel Osunbor started the conversation

    Hi, I'm testing out the sandbox version of wpdatatables, and I want to find out if its possible to set up tables where users are only able to see their own data. I know there's a setting for users to see and edit their own data, but is there a way for them to see their own data without being able to edit it?

    Also, instead of identifying users based on user id, is it possible to identify users based on email address?

    Thanks.

  •  2,572
    Aleksandar replied

    Hello Ezekiel

    Thank you for your interest in our plugin.

    If you want the users to be able to see their own data and add a new row, you can simply select only the "New Entry" button for the front-end:

    9850327829.png

    If you want to allow them only to see their own data, a better approach would be to create a MySQL query-based table generated from the original table. Since the table has to be a database table (so, manual, MySQL query-based, or imported), you can see its database name in the "Editing" tab above the table, in the "MySQL table name for editing" section:

    3048348278.png

    So, then, you would create a new MySQL query-based table with a query similar to this:

    SELECT * FROM wp_wpdatatable_1
    WHERE your_email_column = %CURRENT_USER_EMAIL%

    This will make the plugin compare the email column with the currently logged-in user's email address.

    Please note that your email address needs to be in the table in at least one row in order for you to be able to save this table.

    Kind Regards, 

    Aleksandar Vuković
    [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