Session variables

Home Forums Quform WordPress Session variables

This topic is: resolved
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #33724
    marianogi
    Participant

    Hi!, I use Quform to get user statistics data that I show at the end of the filling with charts. I needed to create a plugin for that and I think that your session variables are perfect for me because I use a PHP script that loads the WP environment with “wp-load.php”, and pass to it some variables with sessions. But I don’t know how to do it because only by requiring the “wp-load.php” doesn’t seem to be enough. How can I use your great “Quform::getService(‘session’)” in my external PHP file? Is it possible? Could I require from my PHP any of your plugin files as I do with “wp-load.php”?

    Thank you in advance for your help. You have an incredible plugin. I can’t believe how great and powerful it is, far beyond if it is possible to do what I want or not.

    #33726
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #33727
    marianogi
    Participant

    Hi, thank you for your super fast response. It does not work for me. I could check that it loads the Quform class because it passes the if ( ! class_exists('Quform')), but after that, I try to get the session and form with $session = Quform::getService('session');
    $form = $session->get('formulario');

    and it does not pass the if ( ! $form instanceof Quform_Form).

    Could it be that something is destroying your session variables?

    Thanks again!

    • This reply was modified 3 years ago by marianogi.
    • This reply was modified 3 years ago by marianogi.
    #33730
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #33731
    marianogi
    Participant

    Hi Ally, thank you again for helping me with this.

    I can confirm that the domain doesn’t change at all. Not even the folder changes, both PHP scripts are in the same folder.

    I have sent the admin credentials through your feedback form.

    Let me explain a bit where is that code:

    I create a plugin to handle all this named “QuForm – Personalización” (at ‘form-desigualdad’ folder). The file that stores the session variable is “form-desigualdad.php” and the file that should get it is “form-desigualdad-API.php”. In this file, I have commented all the session code. You can uncomment it to make your tests.

    Thank you very much!

    #33732
    marianogi
    Participant

    I think that maybe it is important to explain the whole workflow:

    -Users fill the quform, and it automatically redirects to a results page that shows some charts.
    -The chart plugin can get dynamic data from an API URL in JSON, but I need that API URL to be unique to show only the user results, I mean, by his/her entry_id.
    -I am resolving this by now with shortcodes, using you session variables between “add_filter(‘quform_post_process_1′” and “add_shortcode(“. So the shortcode returns a customized URL with the entry_id

    -All this wouldn’t be necessary if the second file could get the session variable the same way the “add_shortcode” does. And I think it would be a bit safer because I don’t like to use variables in the API URL call if they are not necessary.

    I hope I have explained it well, thank you again and again.

    #33742
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #33743
    marianogi
    Participant

    Hi!, thank you again for your concern and help.

    “if the chart script is getting the data through its own request it might not include the session cookie” -> I agree with you, but I didn’t know that could be possible: to make a call to that script without session variables, in the same server.
    “Does it work if you visit the form-desigualdad-API.php directly?” -> yes, “form-desigualdad-API.php” works when I call it directly, but with parameters, of course, not with session variables. That’s why I thought that maybe WordPress is killing the session variables before the API call.

    “if it’s possible to forward the cookie with the chart script data request”, I think I don’t understand what you mean. If you mean passing the data with parameters like “form-desigualdad-API.php?entryid=X”, that’s exactly what I am doing now, and it works, as I said before. But I don’t like this solution, I prefer to use your class and session variables functionality, so my call is much cleaner (and maybe safer too).

    Kind regards,
    Mariano

    • This reply was modified 2 years, 12 months ago by marianogi. Reason: fix expression error
    #33748
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #33751
    marianogi
    Participant

    OMG!!! I can’t believe your support! IT WORKED!!! Thank you very much!!
    I know this could be beyond your support posibilites but you choose to help people and spend a lot of time with their issues.
    Simply this is my best experience purchasing a plugin in 10 years at Codecanyon. I will tell this in their plugin rating, you really deserve it.
    Thank you again!

    Sincerely,
    Mariano

    #33755
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy