Okay
  Public Ticket #2769932
Theme Integration
Closed

Comments

  • Ryan started the conversation

    Before purchasing, I need to know if the following is possible with wpDataTables?...

    1. Create table and chart templates for use in multiple instances, each populated with different data sets using wp_query or similar function
    2. Initiate tables and charts using dynamic php tags (instead of shortcodes) in taxonomy templates like category.php or archive.php
    3. Dynamically populate tables with meta data from all posts within the taxonomy loop

    If this can be accomplished, please provide detailed instructions for how to implement. 

  • Ryan replied

    Can I get a response please? I'm interested in using your plugin but only if it meets the requirements described in my original question.  

  • [deleted] replied

    HI Ryan

    Thank you for reaching out to us.

    My apologies for the late response, we're Christian Orthodox, so we had non-working days for Easter. 

    1. Unfortunately we do not have the option for templates available. At the moment , duplicating the table would be the only way.

    We will work on templates in the future, but there's no other workaround for now.

    2./3. I have forwarded your inquiry to our developers and I will update you as soon as I hear back from them.

    Thank you for your time and patience.

  • [deleted] replied

    Hi Ryan

    Thank you for your patience.

    2. We don't have this built-in yet, but you can with a workaround. Please note that this does require some experience with writing SQL queries and using WP hooks.

    You can create a table with a query like this:

    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

    Then, on your_custom_page you will insert a shortcode of the table ID that you need, with a placeholder like this:

    [wpdatatable id=1 var1=1]

    The second table would be created from a query like this:

    SELECT * FROM second_table WHERE user_id = %VAR1%

    After that, you can use a hook for dynamic 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');

    I hope this helps you achieve the results that you need.

    3. This can be achieved with SQL query based tables, that would pull all this from the database.

    Do let us know if you need any further assitance.


  • Ryan replied

    I purchased the plugin and already found a serious problem while testing. Attached are before/after screenshots of an attempt to get the post_IDs of all posts in the "Test" category using the WPDP generator. This failed to produce any results even though I have seven posts assigned to that category. I ran the same exact query in phpMyAdmin and encountered the same result, but also the following warning...

    Warning: #1292 Truncated incorrect DOUBLE value: 'posts_post.ID'  

    Additionally, if I remove line 5 (...'category.tbl.ID'...), I get duplicate rows of every posts in the Test, Test2 and Test>subTest categories, and if I remove lines 4 and 5, I get unique rows of every post in the database.

    Needless to say, this is not what I expected based on your response to item #3 below. It's even more disappointing when you consider that looping posts from a given category is one of the most basic and common queries in WordPress.

    Before you send a response that blames the Query Constructor, like you did here, I would appreciate an actual working solution for this EXTREMELY BASIC task. Perhaps investigating the solution to this ticket would be a good place to start?...

    https://tmsplugins.ticksy.com//ticket/2580922/

  • [deleted] replied

    Hi Ryan

    WordPress database query constructor is a helper, and often you will need to modify the generated query to get the results you need. The included support for the plugin doesn't include writing or debugging queries, and refers only to advice. 

    The issue can be linked with the alias used in the WHERE (AND) clause - you can't use column aliases, so try changing that from posts_post.post_type to wp_posts.post_type. I can't guarantee that it will work, but it's a good place to start. More about aliases can be found on this URL: https://stackoverflow.com/questions/62564091/sql-error-in-mysql-query-error-unknown-column-post-taxonomy-category-in-on