Home › Forums › Quform WordPress › Session variables
- This topic has 10 replies, 2 voices, and was last updated 2 years, 12 months ago by Ally.
- AuthorPosts
- November 24, 2021 at 10:42 pm #33724marianogiParticipant
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.
November 25, 2021 at 9:54 am #33726AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
November 25, 2021 at 10:39 am #33727marianogiParticipantHi, 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 theif ( ! $form instanceof Quform_Form)
.Could it be that something is destroying your session variables?
Thanks again!
November 26, 2021 at 9:49 am #33730AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
November 26, 2021 at 11:49 am #33731marianogiParticipantHi 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!
November 26, 2021 at 12:01 pm #33732marianogiParticipantI 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.
November 29, 2021 at 10:59 am #33742AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
November 29, 2021 at 11:41 am #33743marianogiParticipantHi!, 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
November 30, 2021 at 6:53 am #33748AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
November 30, 2021 at 9:49 am #33751marianogiParticipantOMG!!! 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,
MarianoDecember 1, 2021 at 9:40 am #33755AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.