Okay
  Public Ticket #1024082
Serialized array - not displaying columns
Closed

Comments

  •  2
    Patrick started the conversation

    Hi,

    Columns will not display (and no data visible) when using serialized php array as a datasource.

    I have followed all your instructions from your site but to no avail and also I have tested this with a simple php file (see below) and the result was that the php itself works (i.e. testing outside of wpdatatables) but the data and coiumns do not show or work when creating it via th wpdatatables admin interface.

    I have tested this on 2 sites and have the same issue.

    Could you let me know how to fix this.

    *** test-wpdatatables.php *** see below

    $return_array = array();
    $return_array[] = array(
        'Id' => '1', // Set the ID
        'Title' => 'Test1', // Set the title
        'Content preview with link' => 'Content1');
    $return_array[] = array(
        'Id' => '2', // Set the ID
        'Title' => 'Test2', // Set the title
        'Content' => 'Content2');
    $return_array[] = array(
        'Id' => '3', // Set the ID
        'Title' => 'Test3', // Set the title
        'Content' => 'Content3');
    echo serialize( $return_array );



  • [deleted] replied

    Hi Patric,

    I tested your code and it works normally. I created simple php file like Attach1 and then just upload it through our plugin and save. You can see resulting table in Attach2. 

    Please try to follow these steps and if you still have problems send me a temporary admin credentials so I can take a look 

  •  2
    Patrick replied

    Hi Miljko,

    Actually that example I gave over simplified what I was doing, I got it to work eventually and it came down to 2 things that got it to work

    define('WP_USE_THEMES', false); // (1) this on the first line
    include(dirname( __FILE__ ) . '/wp-blog-header.php');

    // the WP_Query stuff
    // the array $return_array = array(); // Initializing the array that will be used for the table

    // (2) then this before the last line
    header("HTTP/1.1 200 OK");
    echo serialize( $return_array );

    Hope that helps anybody else, who may have the same issue

    BTW : Great product, really impressed

    Cheers


  • [deleted] replied

    Hi Patrick,

    Thank you for sharing this. We really appreciate it. Also thank you for your kind words