I am not sure why the foreign key is not responding to the filter I am putting in the query. I have three tables. One that has employee data. One that has location data, and one that is a query of the location data and is supposed to be filtered by %current_user_id%
[code]
SELECT * FROM bit_wpdatatable_4 WHERE 1=1 AND bit_wpdatatable_4.userid = %CURRENT_USER_ID%
[/code]
The query - in the "create a table" view is only showing the proper results. However, when I engage it in the second table - employee data - it is showing nothing. Please help. This is a huge part of what I am hoping to use this system for. Being able to show data unique to the user. It is critical that data of one user is not seen by another.
Hi bryan_garcia_sales, Thank you for your purchase.
Sorry but I did not quite understand your issue. Can you describe it in more details? Did you try to execute this query in phpMyAdmin and does it work?
the query works but I am having trouble pulling the user id so the list is only populated by the data from that user. I am finishing that when I link a column to a foreign key direct with the table, the query pulls all rows in the table. I need it to be specific to just the rows with matching userid.
Can you please tell me did you take a look at our documentation about placeholders where you can see how the placeholder can be replaced with the currently logged in user’s ID (if the user is logged in).
I did that, but it is not working when linking the query created table with the foreign key in another table.
[code - SAMPLE TABLE NAMES CHANGED TO PROTECT DATA]
SELECTwpdatatable_4.ID, wpdatatable_4.name, wpdatatable_4.userid FROM wpdatatable_4 WHERE wpdatatable_4.userid = %CURRENT_USER_ID%
[/code]
In the admin area this query returns the proper results. However, when I go to another table and create the foreign key connection to the query table nothing populates. So the results in the cells show the numerical value of the ID they are referencing.
When I connect the foreign key directly to the table that contains the names, it works but shows the full list of names in the table. Not just those that were created by the userid.
Sorry for misunderstanding now I see what are you trying to achieve. Unfortunately something like this is not possible to achieve. The foreign keys can not be "limited" for the users and to enable users to see their own data.
This is the new feature that we added in current version of the plugin but this is something that we will definitely work on to improve so thank you for your observation and suggestion.
That is very unfortunate. This was one of the big parts and seems to be a potential "leak" of customer data.
Is this difficult to pass into the query string by hardcoding the plugin? I don't want to break your plugin but am hoping that you might have a quick fix suggestion.
I am not sure why the foreign key is not responding to the filter I am putting in the query. I have three tables. One that has employee data. One that has location data, and one that is a query of the location data and is supposed to be filtered by %current_user_id%
[code]
SELECT *
FROM bit_wpdatatable_4
WHERE 1=1
AND bit_wpdatatable_4.userid = %CURRENT_USER_ID%
[/code]
The query - in the "create a table" view is only showing the proper results. However, when I engage it in the second table - employee data - it is showing nothing. Please help. This is a huge part of what I am hoping to use this system for. Being able to show data unique to the user. It is critical that data of one user is not seen by another.
Hi bryan_garcia_sales,
Thank you for your purchase.
Sorry but I did not quite understand your issue. Can you describe it in more details?
Did you try to execute this query in phpMyAdmin and does it work?
Best regards.
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
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
the query works but I am having trouble pulling the user id so the list is only populated by the data from that user. I am finishing that when I link a column to a foreign key direct with the table, the query pulls all rows in the table. I need it to be specific to just the rows with matching userid.
Hi bryan_garcia_sales,
Can you please tell me did you take a look at our documentation about placeholders where you can see how the placeholder can be replaced with the currently logged in user’s ID (if the user is logged in).
Best regards.
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
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 did that, but it is not working when linking the query created table with the foreign key in another table.
[code - SAMPLE TABLE NAMES CHANGED TO PROTECT DATA]
SELECTwpdatatable_4.ID,
wpdatatable_4.name,
wpdatatable_4.userid
FROM wpdatatable_4
WHERE wpdatatable_4.userid = %CURRENT_USER_ID%
[/code]
In the admin area this query returns the proper results. However, when I go to another table and create the foreign key connection to the query table nothing populates. So the results in the cells show the numerical value of the ID they are referencing.
When I connect the foreign key directly to the table that contains the names, it works but shows the full list of names in the table. Not just those that were created by the userid.
Hi bryan_garcia_sales,
Sorry for misunderstanding now I see what are you trying to achieve.
Unfortunately something like this is not possible to achieve. The foreign keys can not be "limited" for the users and to enable users to see their own data.
This is the new feature that we added in current version of the plugin but this is something that we will definitely work on to improve so thank you for your observation and suggestion.
Best regards.
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
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
That is very unfortunate. This was one of the big parts and seems to be a potential "leak" of customer data.
Is this difficult to pass into the query string by hardcoding the plugin? I don't want to break your plugin but am hoping that you might have a quick fix suggestion.
Hi bryan_garcia_sales,
We are aware of that and like I said this is the newest feature that came with this version and we will definitely look to improve it.
Something like hardcoding this is highly not recommended because it can appear some unexpected bugs and issues.
But I forwarded your suggestion to my team and I hope that we will implement and upgrade this feature for future releases.
Sorry for any inconvenience.
Best regards.
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
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