For my WordPress site, I am using both PODS, and WPDataTables to manage my data. With that, I am using the placeholders feature to create dynamic SQL queries to display different data depending on what user is logged in. Currently, I can ALMOST do everything I need, but not quite. This is more or less what I would like to achieve:
And this code is working if I hardcode a specific value to var1:
[wpdatatable id=14 var1=5]
Basically, I have two separate shortcodes that work individually, but will not work when put together. Would something like this be possible. Thanks in advance!
I'm not sure if something like this can be achieved, so I forwarded the question to our developers. As soon as I receive a response, I will let you know.
If you just need to use the dynamic placeholder, you can try the following, but you will need some experience with writing SQL queries and using WP hooks.
You can create table with query for example
SELECT
user_id,
user_name,
user_address,
CONCAT('<a href="http:/yoursite.com/your_custom_page?user_id=',user_id,'">Details</a>') AS Details
FROM your_table_name
and then on your_custom_page you will insert shortcode of the tableid that you need with placeholder like this
[wpdatatable id=1 var1=1]
of course, you will create that second table from query like
SELECT * FROM second_table WHERE user_id = %VAR1%
and then you will use our hook for dynamic upsetting placeholders
function updateVAR1($tableID){ global $wdtVar1;
//check is set GET parametar user_id
if(isset($_GET['user_id'])){
//get value from form fieald
$wdtVar1 = $_GET['user_id'];
} }
add_action('wpdatatables_before_get_table_metadata', 'updateVAR1');
Like this I believe you will get result like you need.
SELECT
user_id,
user_name,
user_address,
CONCAT('<a href="http:/yoursite.com/your_custom_page?user_id=',user_id,'">Details</a>') AS Details
FROM your_table_name
I guess I am a little confused on this first section... What page / table am I supposed to be pulling data from here?
For my WordPress site, I am using both PODS, and WPDataTables to manage my data. With that, I am using the placeholders feature to create dynamic SQL queries to display different data depending on what user is logged in. Currently, I can ALMOST do everything I need, but not quite. This is more or less what I would like to achieve:
[wpdatatable id=14 var1=
[pods name="User" template="Company" where="id = {@user.id}"][/pod]
][/wpdatatable]
This shortcode is working, and will pull back a single number, based on the user that is logged in:
Company: [pods name="User" template="Company" where="id = {@user.id}"]
And this code is working if I hardcode a specific value to var1:
[wpdatatable id=14 var1=5]
Basically, I have two separate shortcodes that work individually, but will not work when put together. Would something like this be possible. Thanks in advance!
- Dalton
Hey Dalton
Thanks for your inquiry.
I'm not sure if something like this can be achieved, so I forwarded the question to our developers. As soon as I receive a response, I will let you know.
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
Perfect. Thanks!
Hello again Dalton
If you just need to use the dynamic placeholder, you can try the following, but you will need some experience with writing SQL queries and using WP hooks.
You can create table with query for example
and then on your_custom_page you will insert shortcode of the tableid that you need with placeholder like this
[wpdatatable id=1 var1=1]
of course, you will create that second table from query like
SELECT * FROM second_table WHERE user_id = %VAR1%
and then you will use our hook for dynamic upsetting placeholders
Like this I believe you will get result like you need.
This would avoid using them in the shortcode.
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
I guess I am a little confused on this first section... What page / table am I supposed to be pulling data from here?
That's a general example, Dalton.
Like I said in one of my previous responses, you will need some experience with writing SQL queries and using WP hooks.
We do not provide support for writing custom code or SQL queries, so if you need help with this, please check out these services for customization:
https://codeable.io/?ref=l1TW1
https://wpkraken.io/?tms-plugins
They do develop such solutions, so can you please send your inquiry to them?
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