And I would like to add something to this question as well....
I created table and as far as I see data is written in database, but on the front-end data is not loading in table. It appears empty even if there is records in database, so something I definitely did wrong :)
And, when adding, can I prevent user to add emptyline (cause I see that I've added accidentally several empty lines)
If you're pulling a table from your database, and you want to limit the user to only see his data, you need to have a User ID column in that database table. In every row, a User ID needs to be assigned, so for example, if you have 50 rows in the table, and 5 of those rows contain ID:3, when the user with ID 3 logs in, he should only see the 5 rows.
To achieve that, you can pull the table from the database, and filter it using our placeholder %CURRENT_USER_ID%, like this:
SELECT * FROM yourDatabaseTable WHERE user_id_column = %CURRENT_USER_ID%
How did you create the table that's coming up empty in wpDataTables, can you show me the query, and the database table's name?
Every editable column can be mandatory, so you can go to column settings, and set it as mandatory, so users can't add an empty row.
How can I query DB to only show records in table from logged user on website?
Or when adding data to add in DB with user ID?
Thnx
And I would like to add something to this question as well....
I created table and as far as I see data is written in database, but on the front-end data is not loading in table. It appears empty even if there is records in database, so something I definitely did wrong :)
And, when adding, can I prevent user to add emptyline (cause I see that I've added accidentally several empty lines)
In DB:
On page:
Any chance someone might know what have I done wrong here? :)
Hello Ivan
Thank you for your purchase.
If you're pulling a table from your database, and you want to limit the user to only see his data, you need to have a User ID column in that database table. In every row, a User ID needs to be assigned, so for example, if you have 50 rows in the table, and 5 of those rows contain ID:3, when the user with ID 3 logs in, he should only see the 5 rows.
To achieve that, you can pull the table from the database, and filter it using our placeholder %CURRENT_USER_ID%, like this:
SELECT * FROM yourDatabaseTable
WHERE user_id_column = %CURRENT_USER_ID%
How did you create the table that's coming up empty in wpDataTables, can you show me the query, and the database table's name?
Every editable column can be mandatory, so you can go to column settings, and set it as mandatory, so users can't add an empty row.
Kind Regards,
Aleksandar Vuković
[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