I have several tables that I filter by the logged in user. No problem there, that filter works fine.
I would like to be able to include the filterable columns on the top of the form (ideally with the "Clear Filters" option) but when I do that, the user filter is exposed, which then allows that user to see other user's data. Is there a missing piece to be able to do this or is this not an option? I have looked through the support pages and I don't see anything that defines this type of a scenario.
If I understood, you set the column filters to show above the table as 'filters in a form', but when you include the 'Clear filters', if that button is hit, then that Column you use with the placeholder "Current user ID" gets reset as well, so now they can see all the unfiltered data?
Yes, at the moment, we don't have a perfect solution for this kind of scenario.
If you wish to use a column with a pre-filtered text filter and the placeholder such as 'current user ID' ( Or an SQL Query with a WHERE statement and the Placeholder there, in both cases that only sets the 'default filter value' but hitting 'Clear filter' resets the filter), in this case we don't include the 'Clear filters' to avoid a user hitting it and seeing the entire table;
And we additionally hide that column's filter with CSS.
If you need more details on the CSS, here is an example :
We will skip the first part of the example, where we create the 'current user ID' predefined text filter, just going to show a few screenshots, since I can see you already setup that part.
- Here is how an example table looks before we make any changes, with visible filters above the table.
And now, when we set the pre-filter, with Administrator logged in ( In our case, the user ID is 1), we only see rows matching that user ID.
- The user_ID filter is still visible, so if someone changes/deletes this value, they could see the whole table.
We will hide it from the front-end with some custom CSS added in the "Customize" section of the main table settings.
- It should be easy to do, depending on your knowledge of HTML and CSS.
You have to find the correct selector using the browser inspector tool, add the style "display:none" property to it, and it will disappear from the front-end.
On our example table, the custom CSS is :
#table_1_5_filter_sections {
display:none; }
- Now, the user_ID filter is gone from the front-end.
- Optionally, you can also, of course, hide the user_id column from the front-end, if needed, either using the column settings tab or the "column list" button from the back end Admin area.
And, in regards to adding the 'Clear filter', as mentioned, in this scenario we avoid it, since that would completely reset all column filters.
The only current way to have 'Clear filter' and to completely limit what the table loads is via an SQL Query based table, and if you set a fixed value inside a "WHERE" statement, such as for example :
SELECT * FROM TableName
WHERE ColumnName = 'my fixed value'
Then even if they hit 'Clear filters', the SQL Query of the table is limiting not to show anything else other than that "WHERE" filter.
But if we set it as WHERE column = '%VAR1%'
in that case, that only sets a 'default filter value', by the value we insert in the back-end of the table's placeholders in VAR1;
While if they hit "Clear filters" it would show the entire table again.
At the moment, those are the limitations, but I can see the need for an advanced solution in this scenario;
So you can suggest a better solution for the future, and our devs will do their best to work on it.
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.
If you have coding skills and wish to try to make a custom solution now which could 'clear all filters other than the 'current user id', something like a 'selective clear filters' or anything similar,
I have several tables that I filter by the logged in user. No problem there, that filter works fine.
I would like to be able to include the filterable columns on the top of the form (ideally with the "Clear Filters" option) but when I do that, the user filter is exposed, which then allows that user to see other user's data. Is there a missing piece to be able to do this or is this not an option? I have looked through the support pages and I don't see anything that defines this type of a scenario.
Thank you.
Hi Shane,
If I understood, you set the column filters to show above the table as 'filters in a form', but when you include the 'Clear filters', if that button is hit, then that Column you use with the placeholder "Current user ID" gets reset as well, so now they can see all the unfiltered data?
Yes, at the moment, we don't have a perfect solution for this kind of scenario.
If you wish to use a column with a pre-filtered text filter and the placeholder such as 'current user ID' ( Or an SQL Query with a WHERE statement and the Placeholder there, in both cases that only sets the 'default filter value' but hitting 'Clear filter' resets the filter), in this case we don't include the 'Clear filters' to avoid a user hitting it and seeing the entire table;
And we additionally hide that column's filter with CSS.
If you need more details on the CSS, here is an example :
We will skip the first part of the example, where we create the 'current user ID' predefined text filter, just going to show a few screenshots, since I can see you already setup that part.
- Here is how an example table looks before we make any changes, with visible filters above the table.
And now, when we set the pre-filter, with Administrator logged in ( In our case, the user ID is 1), we only see rows matching that user ID.
- The user_ID filter is still visible, so if someone changes/deletes this value, they could see the whole table.
We will hide it from the front-end with some custom CSS added in the "Customize" section of the main table settings.
- It should be easy to do, depending on your knowledge of HTML and CSS.
You have to find the correct selector using the browser inspector tool, add the style "display:none" property to it, and it will disappear from the front-end.
On our example table, the custom CSS is :
- Now, the user_ID filter is gone from the front-end.
- Optionally, you can also, of course, hide the user_id column from the front-end, if needed, either using the column settings tab or the "column list" button from the back end Admin area.
And, in regards to adding the 'Clear filter', as mentioned, in this scenario we avoid it, since that would completely reset all column filters.
The only current way to have 'Clear filter' and to completely limit what the table loads is via an SQL Query based table, and if you set a fixed value inside a "WHERE" statement, such as for example :
SELECT * FROM TableName
WHERE ColumnName = 'my fixed value'
Then even if they hit 'Clear filters', the SQL Query of the table is limiting not to show anything else other than that "WHERE" filter.
But if we set it as WHERE column = '%VAR1%'
in that case, that only sets a 'default filter value', by the value we insert in the back-end of the table's placeholders in VAR1;
While if they hit "Clear filters" it would show the entire table again.
At the moment, those are the limitations, but I can see the need for an advanced solution in this scenario;
So you can suggest a better solution for the future, and our devs will do their best to work on it.
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.
If you have coding skills and wish to try to make a custom solution now which could 'clear all filters other than the 'current user id', something like a 'selective clear filters' or anything similar,
you can check out our available hooks for Developers on this documentation and see if you can find any hook that might help.
We also added this new developer's handbook, which can allow users with coding skills to make custom add-ons.
Our developers will keep adding more custom hooks/examples there over time.
Please be advised that custom solutions with hooks are not included in our support.
You can also research resources such as Stack Overflow to see if any other user perhaps found a workaround.
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
Thanks, this solution will work for now.
Hi Shane,
Just a small follow-up on this one.
Once again, my sincerest apologies for the mistake on that other/oldest ticket about the Transform Value - just replied to it now.
About this ticket, you're very welcome, I am happy to advise.
If anything else comes up, please don't hesitate to open new tickets.
Thank you.
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