Okay
  Public Ticket #3380087
Data retrieval in PHP
Closed

Comments

  • Hugues Martin started the conversation

    Hello,

    I'd like to use the data in a wpdatables array to create my own php code to represent this data. But I can't find a function to retrieve data from a wpdatables array in php. Is this possible? If so, how?

  •  1,698
    Miloš replied

    Hi, Hugues.

    I am not sure what you need for this use-case exactly, but i will share some informations about sending data from a table, i hope it helps :


    1. If you need to send table data to an API,

    at the moment, with our plugin's built-in functionalities, there is no way to achieve this.

    Our developers did not create a PHP API or REST API for our plugin yet,

    there weren't many requests for it in the past;

    but a couple more people have been asking for it recently.

     We do still have it on our "to-do" list, but the features suggested on this page were more about other features and improvements for the plugin.

    Please feel free to add this as a feature suggestion on the page linked above, so the number of votes goes up. We develop new features based on the number of votes received from our customers, so your vote can be beneficial to have this included sooner.

    You can certainly follow our changeLog page if you'd like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;

    and our newsletter, so you're informed about new features, bug fixes, freebies, etc.

    -

    At this time, if you have coding skills,

    you could make custom routes that you would write yourself,

    and you would have to create the logic that will pull data from the database that you need for tables,  and to send them.

    You can also check our available hooks for developers here.

    A custom workaround like that would not be covered by our support.

    It probably can be done with some custom work, but our developers are very busy at the moment, working on some priority tasks and fixing bugs and issues with our plugins, so they won't be having the time for custom work in the near future.


    2. Or if you need a PHP array, to forward GET parameters (pass dynamic data),

    there is a hook available in the Premium version:

    wpdatatables_filter_url_php_array

    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 the $_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
    }

    I try to be detailed as I can so you can do this easily.

    Let me know if that helps.

    Thank you.

    Kind Regards, 

    Miloš Jovanović
    [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

  • Hugues Martin replied

    No problem. Finally, I managed to do what I wanted with the single cell shortcode.

  •  1,698
    Miloš replied

    Hi, Hugues.

    I am delighted to hear that this has been resolved. Thank you for letting us know.

     Please don't hesitate to create new tickets for anything else we could assist with.

    Have a great day!smile.png

    Kind Regards, 

    Miloš Jovanović
    [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