I've trying to build some mySQL tables / reports in our Wordpress site, and I want to give leaders the ability to do a quick search on their team members.... however, the managers need to be able to click on one of the staff members in the first table (using a link or other reference), then opening a more detailed / second mySQL table.
So 1st table has list of staff with HTTP / Hyperlink to their own "user_id" table field, which opens a 2nd table using the "user_id" field from 1st table to create a new mySQL query just for that individual user.
I've gone through the documentation but can't see where I can set a unique key, to pass to another mySQL query.
We can do this in PHP, but would prefer to use wpDataTables.
Sorry to disappoint you but unfortunately something like this is not possible with the plugin build in features at the moment and it require some code customization of the plugin.
We can offer you our paid customization service where you can hire one of our developers to implement this feature for you.
If you are interested please give us detailed instructions and we can send you quote for this service.
I've done a little bit more work on this with good results.
If you build the SQL query with "select concat" commands, you can pass HTML code and SQL results into your output table, then it gets rendered in the web browser, so you can follow a working link.
This SQL code works fine in wpDataTable, and creates a HREF link with the "user.ID" value against each user:
[wpdatatable id=1]
SELECT
t1.id, t1.user_email AS 'Email Address',
MAX(CASE WHEN t2.meta_key = 'first_name' THEN meta_value END) AS 'First Name',
MAX(CASE WHEN t2.meta_key = 'last_name' THEN meta_value END) AS 'Last Name',
(SELECT CONCAT('<a href="https://example.com/user_id=', t1.id, '">Review ',t1.id,'</a>')) AS "Review Users"
FROM wp_users AS t1
INNER JOIN wp_usermeta AS t2 ON t1.id = t2.user_id
GROUP BY t1.id, t1.user_email
If I craft the HTML code and SQL values to go to a page which has another wpDataTable, then I can run [wpdatatable id=2] using the output values from [wpdatatable id=1] passed on URL string, or a preset variable, which ever is easiest to implement. You could pass as many KV pairs as you wanted, you just need to know how to add them into next SQL query (if possible).
[wpdatatable id=2]
SELECT *
FROM wp_usermeta
WHERE user_id = %WPDB-URL1% AND something_else = %WPDB-URL2%
Do you know if the variable or URL strings will work across pages / tables?
As far as output into Excel, users could just hide or delete that column from export, or leave it there and still be able to click on it from an Excel spreadsheet after its extracted.
UPDATE: I've just tested an Excel export and only the values are exported, not the HTML code injected in the SQL search, so you could use the "SELECT CONCAT" on their username, or some other column in the table, if you don't need redundant data such as "Review User 1, 2, 3" etc...
Glad to hear that you are making progress, good job.
As for the export tools please note that these functionalities are based on a 3rd party HTML5 library. There are some limitations in this library we will emphasize for your awareness:
For tables with server-side processing,only the visible rows will be exported to any format. If you want the entire table to be exported (or copied to a clipboard), you need to choose the “Show All” feature in the “show … entries” block, and then do the export:
You can find more information about this limitations on this link.
We've got everything set up as best we can, with working embedded links from [wpdatatable id=1] to [wpdatatable id=2] using the code below (on different WP pages), we just need a mechanism to pass a unique key between tables, so we can use that key in the second mySQL query to build table 2.
Are the developers able to review this and see if there's currently a way to to pass variables between queries / tables, or build it into a future update. It would make the plugin so much more powerful if users could click values in one table, and be redirected to a second table.
I would prefer to use this option than going back to PHP coding.
I know that one of my colleges did this a customization for one of our users. This is done as a custom solution because we did not find a proper solution to include it in the update in order not to break other functionalities in the plugin.
When we find a proper solution we will definitely include it in the update and in the main features lis of the plugin.
Hi,
I've trying to build some mySQL tables / reports in our Wordpress site, and I want to give leaders the ability to do a quick search on their team members.... however, the managers need to be able to click on one of the staff members in the first table (using a link or other reference), then opening a more detailed / second mySQL table.
So 1st table has list of staff with HTTP / Hyperlink to their own "user_id" table field, which opens a 2nd table using the "user_id" field from 1st table to create a new mySQL query just for that individual user.
I've gone through the documentation but can't see where I can set a unique key, to pass to another mySQL query.
We can do this in PHP, but would prefer to use wpDataTables.
Kind regards,
Miles
Australia
Hi Miles,
Thank you for your purchase.
Sorry to disappoint you but unfortunately something like this is not possible with the plugin build in features at the moment and it require some code customization of the plugin. We can offer you our paid customization service where you can hire one of our developers to implement this feature for you. If you are interested please give us detailed instructions and we can send you quote for this service.
Best regards.
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/
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 Miles,
Thank you for sharing the solution with us.
I will forward this to my team so we can discuss and see if some of the other features ( like editing, sorting etc) will work fine.
Best regards.
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/
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've done a little bit more work on this with good results.
If you build the SQL query with "select concat" commands, you can pass HTML code and SQL results into your output table, then it gets rendered in the web browser, so you can follow a working link.
This SQL code works fine in wpDataTable, and creates a HREF link with the "user.ID" value against each user:
If I craft the HTML code and SQL values to go to a page which has another wpDataTable, then I can run [wpdatatable id=2] using the output values from [wpdatatable id=1] passed on URL string, or a preset variable, which ever is easiest to implement. You could pass as many KV pairs as you wanted, you just need to know how to add them into next SQL query (if possible).
Do you know if the variable or URL strings will work across pages / tables?
As far as output into Excel, users could just hide or delete that column from export, or leave it there and still be able to click on it from an Excel spreadsheet after its extracted.
UPDATE: I've just tested an Excel export and only the values are exported, not the HTML code injected in the SQL search, so you could use the "SELECT CONCAT" on their username, or some other column in the table, if you don't need redundant data such as "Review User 1, 2, 3" etc...
Cheers,
Miles
Hi Miles,
Glad to hear that you are making progress, good job.
As for the export tools please note that these functionalities are based on a 3rd party HTML5 library. There are some limitations in this library we will emphasize for your awareness:
You can find more information about this limitations on this link.
Best regards.
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/
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 Bogdan,
We've got everything set up as best we can, with working embedded links from [wpdatatable id=1] to [wpdatatable id=2] using the code below (on different WP pages), we just need a mechanism to pass a unique key between tables, so we can use that key in the second mySQL query to build table 2.
Are the developers able to review this and see if there's currently a way to to pass variables between queries / tables, or build it into a future update. It would make the plugin so much more powerful if users could click values in one table, and be redirected to a second table.
I would prefer to use this option than going back to PHP coding.
Regards,
Miles
HI Miles,
I know that one of my colleges did this a customization for one of our users.
This is done as a custom solution because we did not find a proper solution to include it in the update in order not to break other functionalities in the plugin.
When we find a proper solution we will definitely include it in the update and in the main features lis of the plugin.
Best regards.
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/
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
Thanks for the heads-up Bogdan,
Please let me know if you need any testers, we'd be happy to look at this with you.
Regards,
Miles
Hi Miles,
You are welcome.
Like I said this is not easy as it looks to implement ,but if we found a proper solution we will look forward to add it as a new feature.
Best regards.
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/
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