PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

pass first page if user logged in

  1. Ardia
    Member

    i have multi-page forms. i want users passed first page adn see second page automaticly if they are logged in. is it possible with some custom code or hook.
    Thanks.

    Posted 13 years ago on Wednesday March 9, 2011 | Permalink
  2. Try the following. It is not very pretty, but I think it will do the job for you. Make sure you replace 134 with your actual form ID

    //NOTE: Replace 134 with your actual form ID
    add_action("gform_pre_render_134", "skip_first_page");
    function skip_first_page($form){
        if(is_user_logged_in()){
            GFFormDisplay::$submission[$form["id"]] = array("page_number" => 2);
            wp_enqueue_script("jquery");
            ?>
            <script type="text/javascript">
            jQuery(document).ready(function(){
                jQuery(".gform_previous_button").hide();
            });
            </script>
            <?php
        }
    
        return $form;
    }
    Posted 13 years ago on Thursday March 10, 2011 | Permalink
  3. Ardia
    Member

    This is it.
    But one question. If i want to use it for multiple forms. Is there way to do this. Something like coma seperate form id numbers or something else ...(sorry i am not a coder )

    And one more thing with this code it passes first page it goes to second page but when i click to next for going to third page i does not go to third page. it stays at the second page Also when i click next it shows previous buton. is there way to fix this?

    Thank you very much Alex.

    Posted 13 years ago on Friday March 11, 2011 | Permalink
  4. Here we go. Have fun.

    add_action("gform_pre_render", "skip_first_page");
    function skip_first_page($form){
        //NOTE: Replace the form IDs below (i.e. "134", "135", "136") with your actual form IDs
        if(in_array($form["id"], array("134", "135", "136"))){
            if(is_user_logged_in()){
    
                if(!isset(GFFormDisplay::$submission[$form["id"]])){
                    GFFormDisplay::$submission[$form["id"]] = array("page_number" => 2);
                }
    
                if(GFFormDisplay::$submission[$form["id"]]["page_number"] == 2){
                    wp_enqueue_script("jquery");
                    ?>
                    <script type="text/javascript">
                    jQuery(document).ready(function(){
                        jQuery(".gform_previous_button").hide();
                    });
                    </script>
                    <?php
                }
            }
        }
        return $form;
    }
    Posted 13 years ago on Friday March 11, 2011 | Permalink
  5. Ardia
    Member

    wonderful :)

    Thanks Alex

    Posted 13 years ago on Saturday March 12, 2011 | Permalink

This topic has been resolved and has been closed to new replies.