There is a placeholder for today when You add conditional formatting to a cell, but in order to hide that column from the edit or new entry modals, editing has to be turned off, and in that case the placeholder would render useless.
Ok, let me explain in detail my issue, because is not exactly the same as the other ticket.
1.- The %TODAY% placeholder doesn´t work in my case, just want to set by default the current day/month/year when I add a new row ( on the pop-up window ) instead of adding it. There´s something more I have to configure or just adding %TODAY% on the "predefined values" for the date column should work?
2.- In regards hiding fields on the "new item pop-up" : What I really need is to store in the field a variable I get in the same php page i´m loading the table. For instance : I have a php page where I have the [wpdatatable id=23], on that php page I have like a $name variable ( because is a profile page but not for the login user, it´s more for clients ) and I need that variable to be stored in one column, if afterwards I can hide it is fine, but the important point here is to get the php variable, is that possible?
1. I am sorry to inform you, but something like this can be done with some customization. The %TODAY% placeholder can only be used for Conditional Formatting, and can't be used for editing.
2. I apologize, but I did not quite understand what you're trying to do with this variable. Can you please explain it to me in a bit more detail, and send me a screenshot or even better a screen cast so that I can see what you mean.
If I can get the second issue fixed I can fix the first one with the same workaround, no problem.
What I want to do is basically introduce any variable/shortcode from my website to the table. I´ve been trying with the %VAR1% but I can´t. Imagine that I have a php page where I place the table shortcode [wpdatatable id=23] showing the table, great, works good. Imagine that I´m calling the page with a variable in the URL like www.website.com/example?client=JohnSmith . In the website I work with that variable with
if (isset($_GET['client'])) { $clientname= $_GET['client']; }
So, how can I work with that variable in the table within the same web page ?? I cannot put $clientname in %VAR1% because is not working.
Please provide me a temporary WP-admin login for your site where this happens, so we could log in and take a look ‘from the inside’ as that’s the most efficient way to see and resolve the issue. We do not interfere with any data or anything else except for the plugin (in case that’s a production version of the site), and of course we do not provide login data to third party. You can write credentials here just check Private Reply so nobody can see them except us.
Our company is located in Serbia and our working time is from 10:00 to 17:00 CET. business days.
Sorry to disappoint you but unfortunately something like this is not possible to achieve with the plugin's built in features at the moment.
But by default when you enter the new value and have a datepicker the datepicker will be highlighted with the today's date so basically you just need to click on it.
We already added this idea for the date to be a new placeholder, but unfortunately for now %TODAY% is only available if you're using conditional formatting for a certain column.
As for this:
In the website I work with that variable with
if (isset($_GET['client'])) {
$clientname= $_GET['client'];
}
So, how can I work with that variable in the table within the same web page ?? I cannot put $clientname in %VAR1% because is not working.
I am sorry to inform you, but unfortunately this is also not possible to achieve with the plugin's built-in features, and it would require some custom work to be done in order to get it to work in this way.
About the second point. How can a shortcode be used in a placeholder then? Makes sense if I say that I can place there my own shortcode? I have tried and doesn´t work. Sorry about this question again but the information I have found in your website is too short about this topic.
You can concat that ID (in your example 'Client') that you get from URL to Variable for example %VAR1%.
All you have to do is to create Custom Page Template and to use do_shortcode()function to place wpDataTable on your page. In that shortcode.
For example:
$id = $_GET['id']; //Id that you get from URL
echo do_shortcode("[wpdatatable id=1 var1=$id]");
From the first look, you may be forgetting the "$", but I can't be too sure. Please note that "var1=$id" has to be equal to "['id']" so that may be another issue, since you have "notas" defined as ID, and later on it's being called as "sintemoresadmin".
Please investigate these two options and let me know.
Instead of using a variable with $ I have the same text "sintemoresadmin" as in the SQL, it´s and easier test, but doesn´t work.
"Notas" is the id of the DIV tag in HTML so is not related with the shortcode, even if I put the shortcode in a single line on a clean page there´re no results on the query.
I have done something more clear, new page called test, just the shortcode passing the var2 as "pending" and the sql query just with the filter post.status = var2....but no results ( file attached "doesntwork2" ) . If you see the file "works2" instead of %VAR2% I use the text I´m looking for and works fine with several results.
Seems that I finally get it worked. Seems that the %VAR% placeholders just admit numbers?? After I changed my variables passing to the shortcode works fine.
But for any reason the search field doesn´t work !! and this is not related with the query itself!! :(
I cannot even edit a field, I get the error attached. I have been looking for this error but all I have found is "disable and enable the plugin", something that I did and didn´t fix the error.
As for editing, searching and filtering - if your MySQL-query based wpDataTable doesn’t work correctly with server-side processing, probably this is happening because wpDataTables server has problems with parsing of the query and building new queries dynamically (rarely happens, but does sometimes). To avoid this please prepare a MySQL view (a stored query), which will return the data that you need, call it e.g. “view1” and then build a wpDataTabled based on a simple query like “SELECT * FROM view1″.
From what I understand, the following query displays results, but you can't edit them, correct?
SELECT ID, post_title, post_content, post_status, wpy4_terms.name FROM wpy4_posts
INNER JOIN wpy4_term_relationships ON wpy4_term_relationships.object_id=wpy4_posts.ID
INNER JOIN wpy4_term_taxonomy ON wpy4_term_taxonomy.term_taxonomy_id=wpy4_term_relationships.term_taxonomy_id
INNER JOIN wpy4_terms ON wpy4_terms.term_id=wpy4_term_taxonomy.term_id
Where post_status="pending"
If that is true, you can try creating a view in PHPMyAdmin by clicking on your database on the left, and then click on SQL tab on the right (see attachment):
CREATE VIEW `view_wpy4_posts` AS SELECT ID, post_title, post_content, post_status, wpy4_terms.name FROM wpy4_posts
INNER JOIN wpy4_term_relationships ON wpy4_term_relationships.object_id=wpy4_posts.ID
INNER JOIN wpy4_term_taxonomy ON wpy4_term_taxonomy.term_taxonomy_id=wpy4_term_relationships.term_taxonomy_id
INNER JOIN wpy4_terms ON wpy4_terms.term_id=wpy4_term_taxonomy.term_id
WHERE post_status="pending";
I cannot say for sure that this is the correct query, but this is how it should like.
Then, in wpDataTables, you'd use this query:
SELECT
* FROM view_wpy4_posts
and that's it.
The other way to do it would be this:
If the table generated successfully, when you go to Editing tab, you should see the table's MySQL name. It is stored in the database under that name. So, if the table's name is (for example) wp_wpdatatable_12, you'd need to create a view in PHPMyAdmin like this:
CREATE VIEW `test` AS SELECT * FROM `wp_wpdatatable_12`;
And then, again, in wpDataTables, generate a new table using this query:
SELECT
* FROM test
Using this plugin feature requires at least a basic knowledge of SQL. It is assumed that you can create the table in some MySQL data manager (e.g., PHPMyAdmin, MySQL Workbench), and prepare an SQL query that will return the data you need. If you do not know how to use MySQL, refer to the “Create a MySQL-query-based table by generating a query to MySQL database” section. It will explain how to create complete tables or MySQL queries without this basic knowledge. Please be advised that preparing MySQL queries for you is not included in the plugin support.
Also, please note these limitations on editing tables with wpDataTables:
Only one MySQL table can be edited at a time. Queries from multiple tables with joins cannot be used as an editable feature, since SQL UPDATE and INSERT statements are generated automatically, and there currently is no way to update multiple tables – but this problem is being investigated and pursued.
Only MySQL tables or tables created with “Create a table manually” and “Create a table by importing data from data source” options of “Create a Table” page can be edited.
Server-side processing MUST be turned on for front-end editing – Note: It will turn on automatically if you forget to enable it.
MySQL Views may not be edited properly – only one of the underlying tables can be edited if you pass the proper ID.
The "view" worked fine but not the edit/new field. Attached the error I get in WPDataTables and in PHPMyadmin. I´ve been reading and as you detailed in your last post "Only one MySQL table can be edited at a time", and I´m using 3 tables to run this query so what I´m trying to do is not possible I guess.
I´ll try to do all this with a new manual table and store the data from scratch, that way the query is going to be easier and no "view" needed I guess.
Thank you very much for your help on this Aleksandar. :)
I've been reading and as you detailed in your last post "Only one MySQL table can be edited at a time", and I'm using 3 tables to run this query so what I'm trying to do is not possible I guess.
Yeah, that's exactly the case here, unfortunately.
As for this new issue, creating a view should resolve the issue. Can you tell me how that view looks like in the query editor?
If it is inline, can you try moving the "* FROM table_name" to a new row? Something like this:
SELECT
* FROM table_name
If this doesn't resolve the issue with search, could you please provide me a temporary WP-admin login for your site where this happens, so we could log in and take a look ‘from the inside’ as that’s the most efficient way to see and resolve the issue. We do not interfere with any data or anything else except for the plugin (in case that’s a production version of the site), and of course we do not provide login data to third party. You can write credentials here just check Private Reply so nobody can see them except us.
Also, please tell me which table ID this is, and paste here how the view was created.
Testing what you just sent me I have found the "error" with the searching.
The error was the ' with the table name. With "SELECT * FROM `view_notes` " works everything but the searching, and with "SELECT * FROM view_notes" works everything even the searching. Doesn´t mind the inline. Maybe is a bug, don´t know.
From version 2.3 we implemented a feature that you can use multiple separate db connections for (MySQL, MSSQL and PostgreSQL) and for MySQL engine we are dynamically adding accent grave ( ` ).
If you remove that accent grave ( ` ) from query in query box, searching and filtering will work fine.
Best regards.
Is there a placeholder for the current date ? I want the current date to be saved in a hidden column everytime a new entry is done.
How can the hidden columns be hidden on the "new entry" pop-up ?
Thanks.
Hello olderdais.
There is a placeholder for today when You add conditional formatting to a cell, but in order to hide that column from the edit or new entry modals, editing has to be turned off, and in that case the placeholder would render useless.
I invite you to take a look at this ticket:
https://tmsplugins.ticksy.com//ticket/1840721/
The customer was asking the same thing, he was only using the user_id instead of %TODAY%, but eventually it works in the same logic.
Please let me know if that helps.
Best regards.
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
Hi Aleksandar,
Ok, let me explain in detail my issue, because is not exactly the same as the other ticket.
1.- The %TODAY% placeholder doesn´t work in my case, just want to set by default the current day/month/year when I add a new row ( on the pop-up window ) instead of adding it. There´s something more I have to configure or just adding %TODAY% on the "predefined values" for the date column should work?
2.- In regards hiding fields on the "new item pop-up" : What I really need is to store in the field a variable I get in the same php page i´m loading the table. For instance : I have a php page where I have the [wpdatatable id=23], on that php page I have like a $name variable ( because is a profile page but not for the login user, it´s more for clients ) and I need that variable to be stored in one column, if afterwards I can hide it is fine, but the important point here is to get the php variable, is that possible?
Thanks.
Hello olderdais.
1. I am sorry to inform you, but something like this can be done with some customization. The %TODAY% placeholder can only be used for Conditional Formatting, and can't be used for editing.
2. I apologize, but I did not quite understand what you're trying to do with this variable. Can you please explain it to me in a bit more detail, and send me a screenshot or even better a screen cast so that I can see what you mean.
Best regards.
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
Hi Aleksandar,
If I can get the second issue fixed I can fix the first one with the same workaround, no problem.
What I want to do is basically introduce any variable/shortcode from my website to the table. I´ve been trying with the %VAR1% but I can´t. Imagine that I have a php page where I place the table shortcode [wpdatatable id=23] showing the table, great, works good. Imagine that I´m calling the page with a variable in the URL like www.website.com/example?client=JohnSmith . In the website I work with that variable with
if (isset($_GET['client'])) {
$clientname= $_GET['client'];
}
So, how can I work with that variable in the table within the same web page ?? I cannot put $clientname in %VAR1% because is not working.
Any suggestion?
Thanks in advanced.
Hi olderdais.
Please provide me a temporary WP-admin login for your site where this happens, so we could log in and take a look ‘from the inside’ as that’s the most efficient way to see and resolve the issue. We do not interfere with any data or anything else except for the plugin (in case that’s a production version of the site), and of course we do not provide login data to third party. You can write credentials here just check Private Reply so nobody can see them except us.
Best regards.
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
Hello again olderdais.
Sorry for late response.
Our company is located in Serbia and our working time is from 10:00 to 17:00 CET. business days.
Sorry to disappoint you but unfortunately something like this is not possible to achieve with the plugin's built in features at the moment.
But by default when you enter the new value and have a datepicker the datepicker will be highlighted with the today's date so basically you just need to click on it.
We already added this idea for the date to be a new placeholder, but unfortunately for now %TODAY% is only available if you're using conditional formatting for a certain column.
As for this:
In the website I work with that variable with
if (isset($_GET['client'])) { $clientname= $_GET['client']; }
So, how can I work with that variable in the table within the same web page ?? I cannot put $clientname in %VAR1% because is not working.
I am sorry to inform you, but unfortunately this is also not possible to achieve with the plugin's built-in features, and it would require some custom work to be done in order to get it to work in this way.
Sorry for any inconvenience.
Best regards.
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
Hi Aleksandar,
Thanks for your update.
About the second point. How can a shortcode be used in a placeholder then? Makes sense if I say that I can place there my own shortcode? I have tried and doesn´t work. Sorry about this question again but the information I have found in your website is too short about this topic.
Kind Regards.
Angel.
Hello again olderdais.
Please take a look at this documentation - http://wpdatatables.com/documentation/table-features/using-placeholders/
You can concat that ID (in your example 'Client') that you get from URL to Variable for example %VAR1%. All you have to do is to create Custom Page Template and to use do_shortcode()function to place wpDataTable on your page. In that shortcode.
For example:
Hope this can help.
Please let me know.
Best regards.
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
Hi olderdais.
From the first look, you may be forgetting the "$", but I can't be too sure. Please note that "var1=$id" has to be equal to "['id']" so that may be another issue, since you have "notas" defined as ID, and later on it's being called as "sintemoresadmin".
Please investigate these two options and let me know.
Best regards.
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
Hi Aleksandar,
Instead of using a variable with $ I have the same text "sintemoresadmin" as in the SQL, it´s and easier test, but doesn´t work.
"Notas" is the id of the DIV tag in HTML so is not related with the shortcode, even if I put the shortcode in a single line on a clean page there´re no results on the query.
I have done something more clear, new page called test, just the shortcode passing the var2 as "pending" and the sql query just with the filter post.status = var2....but no results ( file attached "doesntwork2" ) . If you see the file "works2" instead of %VAR2% I use the text I´m looking for and works fine with several results.
There´s no simplier test I can do on this...
Hi Aleksander,
Seems that I finally get it worked. Seems that the %VAR% placeholders just admit numbers?? After I changed my variables passing to the shortcode works fine.
But for any reason the search field doesn´t work !! and this is not related with the query itself!! :(
Hi Again,
I cannot even edit a field, I get the error attached. I have been looking for this error but all I have found is "disable and enable the plugin", something that I did and didn´t fix the error.
Regards.
Hello again olderdais.
Glad to hear you got it to work.
As for editing, searching and filtering - if your MySQL-query based wpDataTable doesn’t work correctly with server-side processing, probably this is happening because wpDataTables server has problems with parsing of the query and building new queries dynamically (rarely happens, but does sometimes). To avoid this please prepare a MySQL view (a stored query), which will return the data that you need, call it e.g. “view1” and then build a wpDataTabled based on a simple query like “SELECT * FROM view1″.
Please try this and let me know if it works.
Best regards.
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
Hello olderdais.
From what I understand, the following query displays results, but you can't edit them, correct?
If that is true, you can try creating a view in PHPMyAdmin by clicking on your database on the left, and then click on SQL tab on the right (see attachment):
I cannot say for sure that this is the correct query, but this is how it should like.
Then, in wpDataTables, you'd use this query:
and that's it.
The other way to do it would be this:
If the table generated successfully, when you go to Editing tab, you should see the table's MySQL name. It is stored in the database under that name. So, if the table's name is (for example) wp_wpdatatable_12, you'd need to create a view in PHPMyAdmin like this:
And then, again, in wpDataTables, generate a new table using this query:
Using this plugin feature requires at least a basic knowledge of SQL. It is assumed that you can create the table in some MySQL data manager (e.g., PHPMyAdmin, MySQL Workbench), and prepare an SQL query that will return the data you need. If you do not know how to use MySQL, refer to the “Create a MySQL-query-based table by generating a query to MySQL database” section. It will explain how to create complete tables or MySQL queries without this basic knowledge. Please be advised that preparing MySQL queries for you is not included in the plugin support.
Also, please note these limitations on editing tables with wpDataTables:
Only one MySQL table can be edited at a time. Queries from multiple tables with joins cannot be used as an editable feature, since SQL UPDATE and INSERT statements are generated automatically, and there currently is no way to update multiple tables – but this problem is being investigated and pursued.
Only MySQL tables or tables created with “Create a table manually” and “Create a table by importing data from data source” options of “Create a Table” page can be edited.
Server-side processing MUST be turned on for front-end editing – Note: It will turn on automatically if you forget to enable it.
MySQL Views may not be edited properly – only one of the underlying tables can be edited if you pass the proper ID.
Good luck, and best regards.
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
Hi Aleksandar,
Thank you very much for your explanation.
The "view" worked fine but not the edit/new field. Attached the error I get in WPDataTables and in PHPMyadmin. I´ve been reading and as you detailed in your last post "Only one MySQL table can be edited at a time", and I´m using 3 tables to run this query so what I´m trying to do is not possible I guess.
I´ll try to do all this with a new manual table and store the data from scratch, that way the query is going to be easier and no "view" needed I guess.
Thank you very much for your help on this Aleksandar. :)
Regards.
Angel.
Hi again olderdais.
I've been reading and as you detailed in your last post "Only one MySQL table can be edited at a time", and I'm using 3 tables to run this query so what I'm trying to do is not possible I guess.
Yeah, that's exactly the case here, unfortunately.
As for this new issue, creating a view should resolve the issue. Can you tell me how that view looks like in the query editor?
If it is inline, can you try moving the "* FROM table_name" to a new row? Something like this:
If this doesn't resolve the issue with search, could you please provide me a temporary WP-admin login for your site where this happens, so we could log in and take a look ‘from the inside’ as that’s the most efficient way to see and resolve the issue. We do not interfere with any data or anything else except for the plugin (in case that’s a production version of the site), and of course we do not provide login data to third party. You can write credentials here just check Private Reply so nobody can see them except us.
Also, please tell me which table ID this is, and paste here how the view was created.
Best regards.
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
Hi Aleksandar,
Testing what you just sent me I have found the "error" with the searching.
The error was the ' with the table name. With "SELECT * FROM `view_notes` " works everything but the searching, and with "SELECT * FROM view_notes" works everything even the searching. Doesn´t mind the inline. Maybe is a bug, don´t know.
Anyway thank you very much for your help.
Regards.
Angel.
Yeah, olderdais.
Sorry, I may have forgotten to tell you that.
From version 2.3 we implemented a feature that you can use multiple separate db connections for (MySQL, MSSQL and PostgreSQL) and for MySQL engine we are dynamically adding accent grave ( ` ). If you remove that accent grave ( ` ) from query in query box, searching and filtering will work fine. Best regards.
My bad.
Best regards.
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