Home › Forums › Front-end Issues › Front End ACF form with Session Data (three related questions)
Title probably isn’t as descriptive as it needs to be, but the issue I’m trying to solve is rather complex.
Here’s what I’m trying to do:
I’m building a site that requires the user to take a quiz before they register, while also providing the option to take the quiz and view the results without completing registration.
What I’ve done so far:
I’ve managed to get the ACF form tied into the (front end) registration form (using ACF woocommerce account fields plugin as the way to hook into that – this plugin has since stopped working with the latest version of Woocommerce, which means I now have to link these manually). This does successfully save form data to the User’s profile page after a successful registration.
That said, there’s a pretty big issue – if a new user abandons the registration process, their form data persists within the ACF form and stays that way until another user tries to take the quiz + register. The form does not clear itself after a user registers successfully either. If no user ever abandons the registration + quiz, then the data does not persist (but that’s impossible, there’s always going to be people who don’t complete the registration process).
What I’m trying to do now:
Now I’m trying to figure out if there’s a way to split the quiz from the registration process so anyone can take the quiz, save their answers to the current $_SESSION, and then if they decide to register, have that $_SESSION data pass the answers along to populate the appropriate ACF fields in their new profile. I figure if I can do this, it will get rid of some of the persistent data issues I described above while avoiding future compatibility issues when Woocommerce needs to update the form-login.php file.
I can share code if it’s needed, but I’m really working with a pretty vanilla ACF front-end form. I don’t necessarily need pseudo/working code so much as I’m asking for input on what filters may need to be used + why because I can’t find much information on this type of scenario.
Anyway, thanks so much for reading through all of this! And thanks in advance to any and all input/comments/feedback. It’s all really appreciated. 😀
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
🤔 Curious about the ACF user experience? So are we! Help guide the evolution of ACF by taking part in our first ever Annual Survey and guarantee you’re represented in the results. https://t.co/0cgr9ZFOJ5— Advanced Custom Fields (@wp_acf) May 8, 2023
© 2023 Advanced Custom Fields.