Okay
  Public Ticket #1512255
Secure Data & Dynamic Parameter Requirement
Closed

Comments

  • Mycreativewebsols started the conversation

    Hello,

    I have 2 major issues with the plugin utilizing the PHP serialized array method:

    1. Dynamic parameter requirement - I need ability to use $_SESSION or get_option with $_SERVER['REMOTE_ADDR'] to use a user id in order to output results.. Both of these works fine when I directly access the URL but wpdatatable says no data found for table. How exactly wpdatatable pull results from php serialized array url? using php CURL method?

    USAGE EXAMPLE:- I want to pull employee list of a company using its COMPANY ID stored in session or get_option($_SERVER['REMOTE_ADDR'])

    2. Secure data handling - I would like to use is_user_logged_in() function of wordpress before outputing the php serialized array output. This works totally fine when i access the url directly  but wpdatatable always return NO results as  it may not contain wordpress authentication cookie in its request. is_user_logged_in() is always FALSE and wont return any results in wpdatatable even if user is logged in and serialized results can be found by directly accessing  the url.

    How to achieve these 2 goals.. Does the wpdatatable wont even send the $_SERVER['REMOTE_ADDR'] or any server headers, wp login cookies, sessions?? If atleast wp_get_current_user() could work, I can handle both the requirements somehow..

  • Mycreativewebsols replied

    Time is Money $ :) Resolved it myself.. All you need to add is 

    curl_setopt($ch, CURLOPT_COOKIE, $_SERVER['HTTP_COOKIE']);

    at Line 157 of source/class.wdttools.php file during Curl request. This way is_user_logged_in() authentication can be done at remote end i.e., php serialized array URL in this case.


    Cheers,

    ~Vijay

  •  1,689
    Miloš replied

    HI Vijay,
    Thank you for your purchase.


    Yes we are using PHP CURL method but in some cases there is a probability that you will need to add some certificate to the plugin file ( depends on your certificate verification)  You can find more information on this link. So for your this line of code 

    curl_setopt($ch, CURLOPT_COOKIE, $_SERVER['HTTP_COOKIE']);

    will do the trick.


    Nevertheless glad to hear that you found the solution, good job.

    If you have any more issues feel free to open a new ticket, we will gladly help.


    Best regards.

    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