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.

Skipping to second page of a multipage form

  1. webdevstudios
    Member

    I have a multipage form, the first page of which is a user registration form. I'm looking for a way to skip this page of the form if the user is logged in already, which will obviously make the first page unnecessary. Do-able?

    Posted 12 years ago on Wednesday May 4, 2011 | Permalink
  2. You can use this hack to start on page 2 when user is logged in:

    function start_page_filter($form){
    
    	$form_id = $form["id"];
    	$start_page = 2;
    
    	if ( is_user_logged_in() && !$_POST['gform_submit'] )
    		GFFormDisplay::$submission[$form_id]["page_number"] = $start_page;
    
        return $form;
    
    }
    add_filter("gform_pre_render", "start_page_filter");

    I use something similar to start with the page defined in URL (ex.: http://wptest.dev/page?start_page=2 ):

    function start_page_filter($form){
    
    	$form_id = $form["id"];
    	$start_page = $_GET['start_page'];
    
    	if ( isset($start_page) && !empty($start_page) && !$_POST['gform_submit'] )
    		GFFormDisplay::$submission[$form_id]["page_number"] = $start_page;
    
        return $form;
    
    }
    add_filter("gform_pre_render", "start_page_filter");

    Is there a better way how to do this?

    Posted 12 years ago on Thursday May 5, 2011 | Permalink
  3. webdevstudios
    Member

    Worked like a charm! Thanks.

    Posted 12 years ago on Friday May 6, 2011 | Permalink