Sorry to disappoint you, but if you mean to use the built-in option of 'Users see and edit only own data' in the Editing options of your Table;
that can only look up the "currently logged user ID" which is referenced from the "wp_users" SQL Table in your WP Database;
So, when you enable that option, as explained on this Documentation;
you need to choose the "user ID column" and it filters the table, while at the same time, stores this ID for any new row this user adds.
At the moment, this Feature can only work with the "user ID" method/ with an integer Column.
If you wish to see a new built-in option for this Feature which could be used with the "currently logged Username", you can make a development suggestion.
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.
-
For the time being, there is a workaround solution, though.
For example, you can have one main/master Manual table which will store all the data in the database
and you will be able to make an additional SQL Query based Table that pulls data from the same "master table",
and any editing you do on all these other SQL tables are going to be stored in the same table in the database.
-
In one of our latest Updates, we introduced new standard columns for Manual tables (wdt_created_by, wdt_created_at, wdt_last_edited_by and wdt_last_edited_at).
So we can use 'wdt_created_by' Column to set a pre-defined Filter on an SQL Table.
-
For your goal to filter a table only for the currently logged Username, you can do :
SELECT * FROM wp_wpdatatable_1 WHERE wdt_created_by = '%CURRENT_USER_LOGIN%'
What this will do is, any WP User who logs in to see your Table on a Front-End Page;
they can only see the rows they created - without seeing other user's rows.
So you can have a "main/master" Manual table to hold all the user's rows; and you can edit this table as Admin.
For the Front-End Users, check under the Editing options, what is the MySQL TableName.
Then call it in a new SQL Table like :
SELECT * FROM TableName WHERE wdt_created_by = '%CURRENT_USER_LOGIN%'
In the end, place the SQL Table shortcode on a WP Page;
and if a new User loads this Table, it will say "No matching records", in other words, loads an empty table.
If the user ads a new row - the Column automatically stores their username, and now they can see and edit only their own rows.
That can be a workaround solution.
You can download my Video demonstration of this scenario here.
And i just wanted to point out that you can try wpDataTables before purchasing
on our sandbox Demo sites ( you can find links for the main plugin Demo,
as well as add-on Demos, in my signature),
and there is a 15-day money-back guarantee period,
so if you purchase the plugin, you can safely fully test it out, and if it doesn't fit your needs you can request and receive a refund in that period. ( same goes for all plugins and add-ons)
Users see and edit only own data using username is it possiable?
Hello,
Sorry to disappoint you, but if you mean to use the built-in option of 'Users see and edit only own data' in the Editing options of your Table;
that can only look up the "currently logged user ID" which is referenced from the "wp_users" SQL Table in your WP Database;
So, when you enable that option, as explained on this Documentation;
you need to choose the "user ID column" and it filters the table, while at the same time, stores this ID for any new row this user adds.
At the moment, this Feature can only work with the "user ID" method/ with an integer Column.
If you wish to see a new built-in option for this Feature which could be used with the "currently logged Username", you can make a development suggestion.
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.
-
For the time being, there is a workaround solution, though.
For example, you can have one main/master Manual table which will store all the data in the database
and you will be able to make an additional SQL Query based Table that pulls data from the same "master table",
and any editing you do on all these other SQL tables are going to be stored in the same table in the database.
-
In one of our latest Updates, we introduced new standard columns for Manual tables (wdt_created_by, wdt_created_at, wdt_last_edited_by and wdt_last_edited_at).
So we can use 'wdt_created_by' Column to set a pre-defined Filter on an SQL Table.
-
For your goal to filter a table only for the currently logged Username, you can do :
The %CURRENT_USER_LOGIN% is one of our Dynamic Placeholders.
What this will do is, any WP User who logs in to see your Table on a Front-End Page;
they can only see the rows they created - without seeing other user's rows.
So you can have a "main/master" Manual table to hold all the user's rows; and you can edit this table as Admin.
For the Front-End Users, check under the Editing options, what is the MySQL TableName.
Then call it in a new SQL Table like :
In the end, place the SQL Table shortcode on a WP Page;
and if a new User loads this Table, it will say "No matching records", in other words, loads an empty table.
If the user ads a new row - the Column automatically stores their username, and now they can see and edit only their own rows.
That can be a workaround solution.
You can download my Video demonstration of this scenario here.
And i just wanted to point out that you can try wpDataTables before purchasing
on our sandbox Demo sites ( you can find links for the main plugin Demo,
as well as add-on Demos, in my signature),
and there is a 15-day money-back guarantee period,
so if you purchase the plugin, you can safely fully test it out, and if it doesn't fit your needs you can request and receive a refund in that period. ( same goes for all plugins and add-ons)
Let me know if you have any questions.
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