In the back-end there is a setting in the Editing tab "Show all rows in the back-end".
This allows Admin to see all rows in the back-end of the table, but in front-end, not even Admin can see rows which are not associated to his user ID, so i will elaborate more.
2.
To solve this at the front-end, what you can do is,
for example, you can make a main Manual Table for Administrators.
We will not limit editing /seeing rows in that table.
If you have to set the table on front-end for Admins and you wish to deny access for other user roles and non-logged users -
you can set a password on a WP page for Admin's table, or use any Membership Plugin to restrict access only for Admin role on a page with this Manual Table.
-
This will be my example table :
Now, to make a new SQL Table from it,
first, check in Editing Tab/MySQL table name for editing:
in my example, the Manual table name is wp_wpdatatable_39,
so i make a new SQL table that will pull data from it;
and we can choose all columns or just specific columns;
we can also have completely different settings and limitations on the other table,
and you can make multiple SQL Query tables that pull the same data from the "main table".
SELECT column_name1,
column_name2,
column_name3
FROM table_name
-
I want to limit to only show the "Company" column, and i will leave wdt_ID ( because we got to have row ID) and userid ( for userID of limiting rows),
when i hide those columns in the end, the front-end user will only see the "company" column.
SELECT wdt_ID,
userid,
company
FROM wp_wpdatatable_39
Later, you can make another SQL Table that will show some other columns, have other filters and so on ( depending on what you need to achieve)...
This data we gonna display for the users, is data from a given collection. In our case we collect (Used tires) from different clients with different location.
So each month each client will have a new collection of used tires (Our truck drivers driving from location to location, and pick up tires)
It's exactly that kind of data we will need to show the ''user'' (our clients)
All data came in csv format.
Our clients is always the same client with the same ''p-number'' (Its a registration number for danish companies), so we will use this number as ''ID-number''
According to your screenshot, we have WDT-ID, like 1,2,3,4,5,6,7,8,9...
A user ID, in your screenshot, is set to 1,1,1..
Is WDT-ID the ID of the row?? So example user-id 1, have many rows (WDT-ID??)
If so, WDT-ID can show the rows for a user-id, correct?
As we have many collection of used tires from the same client every month, we will need to use the table in a way, so the client can see his pick up history. Data he later with could select, download, and show to a governmental institution.
SQL Table: How do i create a sql table??
i mean, i have already made a table with the corect section, like user id, location, company names, an so on. All these data that belongs to a client is already uploaded. but its uploaded from a csv file.
And every month i will have to upload a new csv file, whithout replace the al data, but simple add more data to the history of the client, so the client can follow his ow data month by month..
Hope its make sense to you??
And last question, im using easywp from namecheap, where multiple databases isnt allowed. Do i need more than one database to create whats needed above?? In my opinion, 1 database is enough, as its the same data we will need to diplay month by month.
I my case i have almost 4000 clients, from different locations.
All the locations is attached to a client, and client have a ''ID''.
all clients is reportet to the goverment. So our data coming from a goverment reporting source where all clients is registrated with a ID number, and copnay name, and CVR number ''company registration''
So i need a login that is equel to the ''cvr'' number.
So showing the row bases the user id seems to be easy. My problem here is the user (Our client) is only allowed to view his own data, but as we report that data to the goverment each month, the client should not have permission to edit the data, only view, and download data. Thats it.
I will do my best to cover as many details as possible to help you achieve the use-case as you described it.
Let me know if i miss any point, and we can come back to it, of course.
1. Client ID number ( user ID number) compared to the table unique row ID, and limit seeing/editing of rows :
- Our Manual tables have an automatically generated Primary Key column ( an integer, auto-increment unique row ID),
which is the 'wdt_ID'.
Every row has to have a unique row ID for each table, so they will be auto-incremented, 1, 2, 3, and so on...
This is used for the "column for editing".
-
If you activate to Limit the rows users can see, then you have to tell our plugin which integer column will be used to associate the user ID from wp_users in your WordPress database.
-
If you allow editing on front-end, then our plugin looks at the currently logged user ID.
From my example, my user ID is 1 - you can check this in the Placeholders section :
So when i make a row, the user ID will auto-populate, and any row this user makes will say 1.
Then if i log as someone else, for example, user with ID 2 from wp_users table in your WordPress database;
then this row will say 2 for any row that user creates.
-
Now, let's say if you don't wish to allow editing to front-end users, but you want to limit the data only to show rows associated with their user ID.
In this case, you can set "Editor Roles" to only Administrator - that way if users with any other role visit the front-end page, they will just see their rows but won't be able to edit anything.
But now the Admin needs to manually input all the user ID's in the rows of user ID column.
If we "Limit editing to own data" , then not even Admin can edit a row, if it does not have his user ID.
So, we will make two tables :
1. The Master table for Administrator to edit everything, and manually input all the user ID rows in user ID column.
2. The SQL table for users, and limit to show them only their rows.
( Refer to my previous response where i explained how to draw SQL tables from Master Manual Table)
2. Updating existing table from CSV :
As you mentioned -
'every month i will have to upload a new csv file, whithout replace the al data, but simple add more data to the history of the client, so the client can follow his ow data month by month.. '
-
You can import your initial data by CSV , and later you will have three options to update existing Manual table from CSV/Excel or Google Spreadsheets.
You will be able to just add new rows to existing data, or replace everything.
SELECT * FROM yourDatabaseTable
WHERE columnName = '%VAR1%'
%VAR1% can be defined in the Placeholders tab when you're creating a table,
or you can pass VAR1 value in the table's shortcode.
-
For example if i have this Master Manual Table,
and i want to make a dynamic SQL Table with VAR1 placeholder. ( Then later i can input different VAR1 in the table shortcode on different pages).
My example SQL Query for the table will be :
SELECT * FROM wp_wpdatatable_44
WHERE company = '%VAR1%'
First, just to initially generate an SQL table with the VAR1 ,
i will set the Cakewalk company name in the VAR1 , in table's Placeholders tab :
-
Then, for example, if i want to make a different page for another Company,
let's say "Adobe". Then i pass that value in the VAR1 of the table shortcode :
2.
Or, if you don't add the condition in an SQL query, you can add %VAR1% in column settings -> Filtering, under "Predefined filtering value".
Then, you can have different versions of the same table, with the VAR1 value passed in the shortcode,
let's say if we had a "Regions" column and we wish to filter a different region per each page.
If we want page 1 for example only filtered for "Region A" , you can set predefined filter to this column as %VAR1% (filter type has to be set as text) :
Then for a page where we need only Region 1 filtered, use shortcode [wpdatatable id=1 var1='Region A'] ,
page 2 for only "Region B", shortcode would be [wpdatatable id=1 var1='Region B'] and so on,
to apply the values defined in the shortcode to the filter.
( This filtering method can be used for any table type, besides Simple Tables)
6. Your example of "user data connected to user ID 8".
Please refer to my answer #1 , where i explain how the userID column works.
If you enable "Limit rows only for current user", in that case if you log in as user 1,
each new row you make will set userid as 1 in user ID column.
If you try to edit other user rows - Even as Admin, if that Admin WP user id is not 1 - there will be an error saying that you are not allowed to edit that row.
- That is i recommend making a Master Table for Admin, and there disable the "Limit rows" option,
if you need Admin to be able to edit the user ID column rows.
- Then for other users, make the other SQL Table so that they can only view the data limited for them - they won't be able to edit anything.
-
I hope that covers everything, but let me know if you have additional questions on what we covered so far.
For the future,
when you have questions or issues which are not related to the title of the active ticket, please open a new ticket, and we will help you there. In that way, issues and questions which are related to different subjects will be in separate tickets so other customers or our support agents can find them easily. Our policy is to have one issue or question per ticket because of the reasons that are described already.
After creating the table manuel for after creating the sql able for user view i get an error, which i dont understand.
This is all the columns from the admin table
So when try to save table for client view i get this error, like there is no data, or unknown field cvr_nr, but even i delete this from sql, then i just get another error which could p_nr is an unknown field..
If you are pulling an SQL Query and at the same time limiting rows for a user ID,
then this error from your screenshot means that the currently logged user ID does not have any associated rows with that user ID in the MySQL table from the database.
So, please make sure to have at least one row of data that has your user ID associated to it.
Please go to the Placeholders Tab of the table - and check what is your current user ID.
As i explained before, we will now try to clarify further.
Here is my example, when i log in WordPress as Administrator, i am the first user on my WordPress since i created everything.
My user ID is 1 - if you go to your table settings, you can check this in the Placeholders section :
Or, you can go to the PhPMyAdmin of your database and check in the wp_users table ( wp_ is the default WordPress database table prefix, on your end it can be different)
then search for your user Email and see what's your user ID in wp_users table.
Please notice this ID column that i marked in the screenshot - these are all the WordPress user ID's in that column.
Our plugin is going to check what is the currently logged user ID and it will match it to that column value.
If the MySQL table that you are pulling the data from on your SQL Query in our plugin does not have at least one row of data with your user ID associated in the integer column that you selected as "userID" column,
in that case, you will get this error that the table is empty.
-
Let me know if that makes sense and if you have any questions.
Hi Again
WPDataTable
So now users can only see their own data, but that results in the ''admin-user'' can also ONLY ''see their own data''
Admin can't see other users' data, but admin needs a total overview of data.
So i followed this guideline: https://wpdatatables.com/faqmd/can-...edit-data/
But of some reason When i select
Generate a query to the MySQL database.
My tables don't appear in the dropdowns.
I need the admin to have a full overview of all user data
We gonna have 3 tables or more:Example of the set up I need with wpdatatbles:
Table 1: All data (Client id, Company name, addresses, pickup location, amount,,,)
Admin can view, edit, and delete all data
Table 2: Specific Data
A user can only view data own data from table1, not edit, or delete
How do I make that works with WPDataTables?
Best regards
Kim
Hi, Kim
Sorry about replying late to this ticket.
-
I will explain how you can achieve your goal.
1.
In the back-end there is a setting in the Editing tab "Show all rows in the back-end".
This allows Admin to see all rows in the back-end of the table, but in front-end, not even Admin can see rows which are not associated to his user ID, so i will elaborate more.
2.
To solve this at the front-end, what you can do is,
for example, you can make a main Manual Table for Administrators.
We will not limit editing /seeing rows in that table.
If you have to set the table on front-end for Admins and you wish to deny access for other user roles and non-logged users -
you can set a password on a WP page for Admin's table, or use any Membership Plugin to restrict access only for Admin role on a page with this Manual Table.
-
This will be my example table :
Now, to make a new SQL Table from it,
first, check in Editing Tab/MySQL table name for editing:
in my example, the Manual table name is wp_wpdatatable_39,
so i make a new SQL table that will pull data from it;
and we can choose all columns or just specific columns;
we can also have completely different settings and limitations on the other table,
and you can make multiple SQL Query tables that pull the same data from the "main table".
-
I want to limit to only show the "Company" column, and i will leave wdt_ID ( because we got to have row ID) and userid ( for userID of limiting rows),
when i hide those columns in the end, the front-end user will only see the "company" column.
Later, you can make another SQL Table that will show some other columns, have other filters and so on ( depending on what you need to achieve)...
You can see my Video example here https://watch.screencastify.com/v/jOXrsJ9jaspWG5m3VqZH
Let me know if that makes sense and if you have any questions
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
Hey. and thanks for your reply! very needed :)
So for example..
This data we gonna display for the users, is data from a given collection. In our case we collect (Used tires) from different clients with different location.
So each month each client will have a new collection of used tires (Our truck drivers driving from location to location, and pick up tires)
It's exactly that kind of data we will need to show the ''user'' (our clients)
All data came in csv format.
Our clients is always the same client with the same ''p-number'' (Its a registration number for danish companies), so we will use this number as ''ID-number''
According to your screenshot, we have WDT-ID, like 1,2,3,4,5,6,7,8,9...
A user ID, in your screenshot, is set to 1,1,1..
Is WDT-ID the ID of the row?? So example user-id 1, have many rows (WDT-ID??)
If so, WDT-ID can show the rows for a user-id, correct?
As we have many collection of used tires from the same client every month, we will need to use the table in a way, so the client can see his pick up history. Data he later with could select, download, and show to a governmental institution.
SQL Table: How do i create a sql table??
i mean, i have already made a table with the corect section, like user id, location, company names, an so on.
All these data that belongs to a client is already uploaded. but its uploaded from a csv file.
And every month i will have to upload a new csv file, whithout replace the al data, but simple add more data to the history of the client, so the client can follow his ow data month by month..
Hope its make sense to you??
And last question, im using easywp from namecheap, where multiple databases isnt allowed. Do i need more than one database to create whats needed above?? In my opinion, 1 database is enough, as its the same data we will need to diplay month by month.
Best regards
Kim
And one thing more.
I my case i have almost 4000 clients, from different locations.
All the locations is attached to a client, and client have a ''ID''.
all clients is reportet to the goverment. So our data coming from a goverment reporting source where all clients is registrated with a ID number, and copnay name, and CVR number ''company registration''
So i need a login that is equel to the ''cvr'' number.
How can i do this with wpdatatbles??
Here is an example.
This data is connected to user id 8, but in admin back-end the user id is set to 1??
Im not sure i understand this.. can you explain please :)
And one more!!
So showing the row bases the user id seems to be easy. My problem here is the user (Our client) is only allowed to view his own data, but as we report that data to the goverment each month, the client should not have permission to edit the data, only view, and download data. Thats it.
Hi, Kim
Sorry for the waiting time.
I will do my best to cover as many details as possible to help you achieve the use-case as you described it.
Let me know if i miss any point, and we can come back to it, of course.
1. Client ID number ( user ID number) compared to the table unique row ID, and limit seeing/editing of rows :
- Our Manual tables have an automatically generated Primary Key column ( an integer, auto-increment unique row ID),
which is the 'wdt_ID'.
Every row has to have a unique row ID for each table, so they will be auto-incremented, 1, 2, 3, and so on...
This is used for the "column for editing".
-
If you activate to Limit the rows users can see, then you have to tell our plugin which integer column will be used to associate the user ID from wp_users in your WordPress database.
-
If you allow editing on front-end, then our plugin looks at the currently logged user ID.
From my example, my user ID is 1 - you can check this in the Placeholders section :
So when i make a row, the user ID will auto-populate, and any row this user makes will say 1.
Then if i log as someone else, for example, user with ID 2 from wp_users table in your WordPress database;
then this row will say 2 for any row that user creates.
-
Now, let's say if you don't wish to allow editing to front-end users, but you want to limit the data only to show rows associated with their user ID.
In this case, you can set "Editor Roles" to only Administrator - that way if users with any other role visit the front-end page, they will just see their rows but won't be able to edit anything.
But now the Admin needs to manually input all the user ID's in the rows of user ID column.
If we "Limit editing to own data" , then not even Admin can edit a row, if it does not have his user ID.
So, we will make two tables :
1. The Master table for Administrator to edit everything, and manually input all the user ID rows in user ID column.
2. The SQL table for users, and limit to show them only their rows.
( Refer to my previous response where i explained how to draw SQL tables from Master Manual Table)
2. Updating existing table from CSV :
As you mentioned -
'every month i will have to upload a new csv file, whithout replace the al data, but simple add more data to the history of the client, so the client can follow his ow data month by month.. '
-You can import your initial data by CSV , and later you will have three options to update existing Manual table from CSV/Excel or Google Spreadsheets.
You will be able to just add new rows to existing data, or replace everything.
Please check more details here.
3.
No, i don't think that you will need multiple databases.
One database will be enough to achieve what you need here.
You can just split the data in multiple tables, if needed, but they can all be part of the same database.
4. Each client will have a "CVR number" or "Company registration".
You said : 'So i need a login that is equel to the ''cvr'' number.'
Our plugin does not handle any kind of WordPress logins, you will have to do that in another way.
You can try installing any Membership Plugin, and see if they have some custom login options that you might use.
Or maybe some kind of a Login Form Plugin,
but we don't have much experience with something like that, so i can't recommend what can be the best way.
5. If you would have different pages where you might pre-filter tables,
here is how predefining filters can work :
-
If you wish to try Pre-filtering tables through URL, please check out this page with examples.
-
You can also use placeholders for table generation.
1. For example, if you have a MySQL query-based table, you can use this query:
%VAR1% can be defined in the Placeholders tab when you're creating a table,
or you can pass VAR1 value in the table's shortcode.
-
For example if i have this Master Manual Table,
and i want to make a dynamic SQL Table with VAR1 placeholder. ( Then later i can input different VAR1 in the table shortcode on different pages).
My example SQL Query for the table will be :
First, just to initially generate an SQL table with the VAR1 ,
i will set the Cakewalk company name in the VAR1 , in table's Placeholders tab :
-
Then, for example, if i want to make a different page for another Company,
let's say "Adobe". Then i pass that value in the VAR1 of the table shortcode :
2.
Or, if you don't add the condition in an SQL query, you can add %VAR1% in column settings -> Filtering, under "Predefined filtering value".
Then, you can have different versions of the same table, with the VAR1 value passed in the shortcode,
let's say if we had a "Regions" column and we wish to filter a different region per each page.
If we want page 1 for example only filtered for "Region A" , you can set predefined filter to this column as %VAR1% (filter type has to be set as text) :
Then for a page where we need only Region 1 filtered, use shortcode [wpdatatable id=1 var1='Region A'] ,
page 2 for only "Region B", shortcode would be [wpdatatable id=1 var1='Region B'] and so on,
to apply the values defined in the shortcode to the filter.
( This filtering method can be used for any table type, besides Simple Tables)
-
I also made a short video example - please check it out here.
6. Your example of "user data connected to user ID 8".
Please refer to my answer #1 , where i explain how the userID column works.
If you enable "Limit rows only for current user", in that case if you log in as user 1,
each new row you make will set userid as 1 in user ID column.
If you try to edit other user rows - Even as Admin, if that Admin WP user id is not 1 - there will be an error saying that you are not allowed to edit that row.
- That is i recommend making a Master Table for Admin, and there disable the "Limit rows" option,
if you need Admin to be able to edit the user ID column rows.
- Then for other users, make the other SQL Table so that they can only view the data limited for them - they won't be able to edit anything.
-
I hope that covers everything, but let me know if you have additional questions on what we covered so far.
For the future,
when you have questions or issues which are not related to the title of the active ticket, please open a new ticket, and we will help you there. In that way, issues and questions which are related to different subjects will be in separate tickets so other customers or our support agents can find them easily. Our policy is to have one issue or question per ticket because of the reasons that are described already.
Thank you for understanding.
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
Hi.
After creating the table manuel for after creating the sql able for user view i get an error, which i dont understand.
This is all the columns from the admin table
So when try to save table for client view i get this error, like there is no data, or unknown field cvr_nr, but even i delete this from sql, then i just get another error which could p_nr is an unknown field..
What is im doing wrong??
Hi, kim
Sorry for the waiting time
If you are pulling an SQL Query and at the same time limiting rows for a user ID,
then this error from your screenshot means that the currently logged user ID does not have any associated rows with that user ID in the MySQL table from the database.
So, please make sure to have at least one row of data that has your user ID associated to it.
Please go to the Placeholders Tab of the table - and check what is your current user ID.
As i explained before, we will now try to clarify further.
Here is my example, when i log in WordPress as Administrator, i am the first user on my WordPress since i created everything.
My user ID is 1 - if you go to your table settings, you can check this in the Placeholders section :
Or, you can go to the PhPMyAdmin of your database and check in the wp_users table ( wp_ is the default WordPress database table prefix, on your end it can be different)
then search for your user Email and see what's your user ID in wp_users table.
Please notice this ID column that i marked in the screenshot - these are all the WordPress user ID's in that column.
Our plugin is going to check what is the currently logged user ID and it will match it to that column value.
If the MySQL table that you are pulling the data from on your SQL Query in our plugin does not have at least one row of data with your user ID associated in the integer column that you selected as "userID" column,
in that case, you will get this error that the table is empty.
-
Let me know if that makes sense and if you have any questions.
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