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?
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?
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?
Worked like a charm! Thanks.