Hello @quazy,
Sorry for the late reply.
Currently, there is no such option, you can use only pure SQL.
But it sounds like a good idea for improvement. I will add this to my backlog.
Hope it helps.
Regards,
Ian
Hello @quazy,
I just have published WPTables 1.3.7 with support for MySQL variables.
Please update and try predefined variable $user_id as following:
SELECT * FROM users WHERE ID = $user_id
Also, you can use wptables_mysql_query filter to modify MySQL query in your own way using PHP.
Please let me know if it works for you.
Regards,
Ian
Hello @iansadovy,
I am starting to work with WordPress and WPTables.
Can you give me more information on using wptables_mysql_query?
I need filter the customers dinamically as the user needs.
Thank you.
Regards,
Iñigo.
Hello @igvol,
The main purpose of the wptables_mysql_query filter is to allow using custom variables in the MySQL query:
- You define the query in the admin and use some special placeholder that you want to be replaced dynamically while executing. For example, if you want to show the table with data only for current month:
SELECT * FROM sales WHERE date > $current_month
- Then, you define filter in the PHP (i.e. functions.php) to replace $current_month with actual date:
add_filter('wptables_mysql_query', 'my_custom_query');
function my_custom_query($query) {
return str_replace('$current_month', date('Y-m-01'), $query);
}
On the other hand, if you want to allow your users to filter the data dynamically on the front-end, it may be connected to the following thread – https://wordpress.org/support/topic/custom-filter-2/
Hope it helps.
Regards,
Ian
-
This reply was modified 8 years, 1 month ago by
Ian Sadovy.
-
This reply was modified 8 years, 1 month ago by
Ian Sadovy.