Okay
  Public Ticket #2583058
Variables
Closed

Comments

  • David started the conversation

    I am just wondering if there is any way to pass values to the placeholders other than in the short codes.  Can I pass values in the URL or assign the value of a field in a page?  I need my user to be able to dynamically change the date used in the query.


    Thanks you so much for any assistance or suggestions you may be able to offer.

  •  2,572
    Aleksandar replied

    Hello David

    Thank you for your purchase.

    Well we don't have this built-in, but you can try the following workaround 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

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia 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