0

I want to create a "User Guide" form that will allow users to answer questions and pick the categories that they are interested in viewing. After they pick their categories and answer the questions I would like it to redirect them to a page with a customized sidebar menu with the categories that they chose.

I am using Gravity Forms and it has let me have users pick categories they are interested in, however, I do not know how to have it connected with a sidebar menu customized to the answers they chose.

Any suggestions on a plugin or code I could use would be greatly appreciated, thank you.

2
  • Please provide a bit more detail. Do you already have an application environment? Are you using a database on the back-end? If so, which database? Do you have a plan to use cookies, sessions, database, something else, to pass values to the form? Your answers to these questions could drive the potential answers. Commented Sep 16, 2019 at 19:37
  • @MikeBaxter I edited my question, please let me know if I still need to provide more detail. Thank you. Commented Sep 19, 2019 at 20:05

2 Answers 2

0

Easy way to achieve your goal, use WPForms This have a feature like Multi page form

2
  • Thank you for the response. This looks like a helpful tool to do the first thing I need to do, however, how would it collect the data the users answer to display a sidebar menu based on their answers? Commented Sep 16, 2019 at 16:46
  • It seems your project need wpforms.com/addons/surveys-and-polls-addon. Though I am not sure how to get this, but it looks like this. Commented Sep 17, 2019 at 5:32
0

What you want to do is relatively easy, if you are familiar with Wordpress Theme modifications. The following will assume you are at least comfortable with PHP, and hopefully Wordpress Theme modification. If not, I can provide some additional links in subsequent updates to this answer ... just let me know.

First step: Gravity Forms documentation has instructions for "Populating a Form Based On Another Submission". Specifically, see their section on "Setting up the first form to send data using confirmations". Use those instructions to pass your form field(s) to the desired the desired page(s) within your site.

Next: You will need to modify your theme's page template(s) (or create a child theme) to use those parameters for calculating which custom nav menu, dynamic sidebar, or other object to display. Use $_GET to extract your parameters similar to the following:

if (isset($_GET['Param_A'])){
    switch ($_GET['Param_A']){
        case "User_Response_A":
            dynamic_sidebar( 'custom-sidebar-a' );
            break;
        case "User_Response_B":
            dynamic_sidebar( 'custom-sidebar-b' );
            break;
        case "User_Response_C":
            dynamic_sidebar( 'custom-sidebar-c' );
            break;
        default:
            dynamic_sidebar( 'custom-sidebar-WHATEVER' );
    } // end switch
} // end if

If you are comfortable with PHP, but not so comfortable with Wordpress Theme modifications, you could use an intermediary plugin like Insert PHP Code Snippet to add a modified version of the PHP I provided to any widget area.

If you want to get really tricky, you could use the $_GET value to set a cookie value, then use AJAX calls to change the sidebar/menu content in real-time. That is far more complex to setup. Please submit another Question, if you wanted to go that route.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.