We're Moving to a New Support Platform – Starting June 1st!

We’re excited to let you know that starting June 1st, we’ll be transitioning to a new support system that will be available directly on our product websites – Amelia, wpDataTables, and Report Builder. In fact, the new support platform is already live for Amelia and wpDataTables, and we encourage you to reach out to us there.

You'll always be able to reach us through a widget in the bottom right corner of each website, where you can ask questions, report issues, or simply get assistance.

While we still do not offer live support, a new advanced, AI-powered assistant, trained on our documentation, use cases, and real conversations with our team, is there to help with basic to intermediate questions in no time.

We're doing our best to make this transition smooth and hassle-free. After June 1st, this current support website will redirect you to the new "Contact Us" pages on our product sites.

Thanks for your continued support and trust – we’re excited to bring you an even better support experience!

Okay
  Public Ticket #2805080
wpdatatables serialized php using VAR1
Closed

Comments

  • Noah started the conversation

    Hello, 

    I need the flexibility of the php serialized array based table so that I can include dynamic columns, but in order to make the correct mysql database call in my php script I need to be able to pass url parameters to the script.  Since wpdatatables is making a cURL call to the parser, I can't use $_GET, so instead I'm using some script on the plugin side to add the url parameter to VAR1 in the wpdatatables shortcode.  

    My question is how to receive the VAR1 value in my php script that's producing the serialized array.  Any help much appreciated!

    Best, 

    Noah

  • [deleted] replied

    Hi Noah

    Thank you for reaching out to us.

    I have forwarded this to our developers as they will be able to provide a more accurate answer. I will update you as soon as I hear back from them.

    We appreciate your time and patience.


  • Noah replied

    Thanks!  Any help much appreciated, we're on a time crunch.  

  • [deleted] replied

    Hi Noah

    Thank you for your patience, we really appreciate it.

    You need to add one more hook  to filter that URL of PHP file.

    In file wp-content/plugins/wpdatatables/source/class.wpdatatable.php: around line 1875

    you will find this

    case 'serialized':

    and under it add this

    $url =  apply_filters('wpdatatables_filter_url_php_array', $tableData->content, $this->_wpId);

    so it looks like this

    7837078816.png

    In hook you will do something like this

    function test ($url,$id) {
    // all data from current user
    // you can fetch only what you need
    $userData = wp_get_current_user()->data;   if(isset($userData)){       $url .= '?' . http_build_query($userData);    }
    return $url;
    }
    add_filter('wpdatatables_filter_url_php_array', 'test', 2 , 10

    In the PHP file, you will use $_GET method to take the values from the URL which is filtered with the hook

    // you can check then for ID or user_login or user_pass or user_nicename or user_email ...
    if(isset($_GET['user_login'])){      //do somthing
    }


    Do let us know if you need any further assistance.