squeeze.module on line 61

if ($user->uid > 0) {
  $sid = db_result(db_query("SELECT sid FROM {webform_submission} WHERE nid = %d AND uid = %", $squeeze_page_nid, $user->uid));
}
else {
$sid = $_SESSION['webform_submissions'][$squeeze_page_nid];
}

uid = % argument is missing modifier (uid = % should be uid = %d)
{webform_submission} should be {webform_submissions}

once I fixed the above problems it works for anonymous users and for logged in user once the form has already been submitted (revisit). but it does not work for logged in users with no previous form submission.

$sid needs to be set for 3 conditions
1. condition: user = 0, $sid = $_SESSION['webform_submissions'][$squeeze_page_nid];
2. condition: user > 0 & db_results = false, $sid = $_SESSION['webform_submissions'][$squeeze_page_nid];
3. condition: user > 0 & db_results = true, $sid = db_results

Form the above code it looks like $sid is only set for 2 conditions as condition 3 results in an empty query.
1. condition: user = 0, $sid = $_SESSION['webform_submissions'][$squeeze_page_nid];
2. condition: user > 0, $sid = db_results

Comments

pavel.karoukin’s picture

Wow. Not sure how this sneaked there. Looks like I did not tested it with authenticated users enough.

Thank you for bugreport. I will fix it soon!

ndwilliams3’s picture

I did not notice it either as I tested anonymous. I tried adding another if statement for option 3 but could not get it to work. It always redirects to the form confirmation page on submit instead of the file. Thanks for the quick response

pavel.karoukin’s picture

Status: Active » Needs review

Just commited fix (should be available today in the dev .tar.gz release). Here is diff - http://drupalcode.org/viewvc/drupal/contributions/modules/squeeze/squeez...

Let me know if it works for you and thank you again for spotting this!

ndwilliams3’s picture

still not working for authenticated users. Still getting the webform confirmation page.

ndwilliams3’s picture

I am thinking that function squeeze_webform_save_sid_on_submit on line 124 might be the culprit. looks like the redirect is only set for anonymous users. Not familiar with webform or $_SESSION, so I am not sure.

ndwilliams3’s picture

Think I have a fix

line 60

<?php
 if ($_SESSION['webform_submissions'][$squeeze_page_nid] > 0) {
 
           $sid = $_SESSION['webform_submissions'][$squeeze_page_nid];
 
         }
 
         elseif ($user->uid > 0) {
 
           $sid = db_result(
 
                    db_query(
 
                     "SELECT sid FROM {webform_submissions} WHERE nid = %d AND uid = %d", 
 
                      $squeeze_page_nid, 
 
                      $user->uid
 
                    )
 
                  );
 
        }
 
?>

change to

<?php
        if ($user->uid > 0) {
          $sid = db_result(
                   db_query(
                     "SELECT sid FROM {webform_submissions} WHERE nid = %d AND uid = %d", 
                     $squeeze_page_nid, 
                     $user->uid
                   )
                 );
        }
        
        else {
          $sid = $_SESSION['webform_submissions'][$squeeze_page_nid];
        } 
?>

line 124

<?php
function squeeze_webform_save_sid_on_submit($form, &$form_state) {
 
   global $user; 
 
   if ($user->uid == 0) {
 
     $sid = $form_state['values']['details']['sid'];
 
     $nid = $form_state['values']['details']['nid'];
 
     $_SESSION['webform_submissions'][$nid] = $sid;
 

     if ($_SESSION['destination']) {
 
       $form_state['redirect'][0] = $_SESSION['destination'];
 
       $_SESSION['destination'] = FALSE;
 
     }
 
   }
 
 }
?>

change to

<?php
function squeeze_webform_save_sid_on_submit($form, &$form_state) {
  global $user;
  
  $sid = $form_state['values']['details']['sid'];
  $nid = $form_state['values']['details']['nid'];
  
  if ($user->uid == 0) {
    $_SESSION['webform_submissions'][$nid] = $sid;
  }
  
  if ($_SESSION['destination']) {
    $form_state['redirect'][0] = $_SESSION['destination'];
    $_SESSION['destination'] = FALSE;
  }
}
?>

Working for me for both authenticated user and anonymous user.

pavel.karoukin’s picture

Sorry for slow response and thank you for submitting code changes!

I am not sure we need first part of code change, but second one is definitely bug fix. I've committed it in to CVS. Please let me know if it work for you or no (it works for me). Updated -dev package should be available soon. Here is diff of change - http://drupalcode.org/viewvc/drupal/contributions/modules/squeeze/squeez...

pavel.karoukin’s picture

Status: Needs review » Closed (fixed)

I assume bug is fixed finally so I am closing this issue. Feel free to reopen it if you will find problem with it! And thank you very much for helping with it!