We're Moving to a New Support Platform – Starting June 1st!
We’re excited to let you know that starting June 1st, we’ll be transitioning to a new support system that will be available directly on our product websites – Amelia, wpDataTables, and Report Builder. In fact, the new support platform is already live for Amelia and wpDataTables, and we encourage you to reach out to us there.
You'll always be able to reach us through a widget in the bottom right corner of each website, where you can ask questions, report issues, or simply get assistance.
While we still do not offer live support, a new advanced, AI-powered assistant, trained on our documentation, use cases, and real conversations with our team, is there to help with basic to intermediate questions in no time.
We're doing our best to make this transition smooth and hassle-free. After June 1st, this current support website will redirect you to the new "Contact Us" pages on our product sites.
Thanks for your continued support and trust – we’re excited to bring you an even better support experience!
We're using the Master Detail extension to show product details in a page template and would like the ability to show/hide certain fields depending on user role. Is there a filter available to call a different template based on role, or a method for wrapping the placeholders in an "if" statement to control what's shown to different users?
Hi, Ryan
Thanks for reaching out to us.
This can be done, I will show you an example with our dummy table.
If I have this table:
This is a manual table that 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.
So, we're only left with hiding unnecessary columns, adding names, and so on.
Hope this helps.
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia 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
I appreciate the response, though it doesn't really address the original question. We're looking for a solution specific to filtering Master Detail page templates - either a way to assign different page templates for different user roles via hook, or a way to wrap the %PLACEHOLDERS% with conditional statements via helper function. Is it possible?
Hi, Ryan. Let's try something like this solution.
First, you need to create a button (master-detail) column in your existing table with Master-Detail add-on and then set a custom page (post) where users will be redirected after clicking on the button.
Then, on that custom page, you will insert a table created with an SQL query and using placeholders.
If you have that table in the database then you will use it for creating a new table with an SQL query and placeholders.
If you create a manual table then you will use the table that is created in the database (you can find its name in the Editing tab under "MySQL name table for editing").
Those database tables have names like wp_wpdatatable_1,wp_wpdatatable_2... (where wp_ is the default prefix of the database table, but on your end, it could be anything, so look for your_prefix_wpdatatable_1...).
Then, use that table's database name to create a new one with a query.
So you will create a new table like this
Then on that custom page, you would insert some default column_name value in shortcode like
[wpdatatable id=1 var1=test]
Now hooks. You will add this hook in your functions.php of your child theme or theme, depends on what you are using, to filter this var1.
And then you will use our hook for dynamically updating placeholders:
This is the only way because the shortcode is executed before the content on the page or post.
Like this when the user clicks on the More details button (that you will create with Master-Detail) it will be redirected to your custom page (that you set in MD).
On that page, you will insert the shortcode of the Child table created from the query and placeholder.
After loading the page, the column value will be replaced with a placeholder, placeholders will be replaced in the query and you will get a table that is filtered with that placeholder.
I hope that I haven't confused you with this, but I try to be as detailed as I can so you can understand what and how you can achieve with this.
Let me know if this fits your needs.
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia 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