As previously announced via banners and our newsletters, support is no longer available through this platform.
For easier navigation, you can still click on "Submit a Ticket" here, choose the appropriate category, and you'll be redirected to the correct support channel for your plugin.
You can still access your previous tickets and browse public tickets, but please note that responding to tickets is no longer possible.
Paid customers: Please log in to your store account for support.
Pre-purchase questions: Use the support widget in the bottom-right corner of our websites:
https://wpamelia.com
https://wpdatatables.com
https://wpreportbuilder.com
hello,
How do I filter a table on user roles? I understand how to only show users their entries. My scenario is that I have users submitting data in a form, going to a MySQL table. I’m displaying the data back to the user and then want to show the data for an area to a manager. The managers email and user role is captured in the form, so I just need to know how to filter the table based on the role of the user viewing the table.
Hi Jeffrey
Thank you for reaching out to us.
If I understand your scenario correctly, you can add the placeholder %CURRENT_USER_ID% as the predefined filtering value in column settings of "User ID" column, and the table will automatically be filtered per the ID of the currently logged in user.
I hope this helps, do let us know if there is anything else we can assist you with.
I need to filter by the user role on a table, not just the id. How can I filter by user role?
If the dependency is a user role, for example, we could make it work like this:
If I have this table:
This is a manual table which has manually entered IDs from wp_users and roles from wp_usermeta:
So, then I go to create an SQL query based table which will display entries based on user roles using this query:
When I'm logged in with user ID = 1, I see this:
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:
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.
Awesome! I will try this
Do let us know if you need any further assistance, we are always happy to help
Have a wonderful day!