ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Flashdata, Sessions etc.

November 21, 2012 11:34am

Subscribe [1]
  • #1 / Nov 21, 2012 11:34am

    greg.thompson

    12 posts

    Ok first and foremost I’m a CI developer by default. I’m tasked with building a module in EE and naturally want to use alot of CI class functions. One of the biggest issues I’ve ran into is session data. I’ve noticed there’s no support for sessions, which sucks. So my next route was flashdata. I then realized (one of the major fallbacks of flashdata) that if some hits refresh, all data is lost.

    I’m basically building a stepped checkout process. I’d like the final step to be a new method and the only option I have, to pass data to the new method is with flash data. I need to make sure that for any reason they refresh on this page, all their data isn’t lost. I also noticed there’s no support for “keep_flashdata()”. So basically my hack is to keep resetting the flash data…

    $reg_info = $this->EE->session->flashdata('registrant');
    $this->EE->session->set_flashdata('registrant', $reg_info);

    Do you guys have any insight into better way’s to do this? This seems like a hack to me. here’s my setup…

    This snippet is after the form validates and everything is good…
    $flashdata = array(

    'first_name'=>$this->EE->input->post( 'first_name' ),
          'last_name'=>$this->EE->input->post( 'last_name' ),
          'email_address'=>$this->EE->input->post( 'email_address' ),
          'address_line_1'=>$this->EE->input->post( 'address_line_1' ),
          'address_line_2'=>$this->EE->input->post( 'address_line_2' ),
          'city'=>$this->EE->input->post( 'city' ),
          'state'=>$this->EE->input->post( 'state' ),
          'zip'=>$this->EE->input->post( 'zip' ),
          'shirt'=>$this->EE->input->post( 'shirt' ),
          'sumbmission_type'=>$this->EE->input->post( 'sumbmission_type' ),
          'loc'=>$this->EE->input->post( 'loc' ),
          'reg_date'=>time(),
          'event_ref_id'=>$this->getEventID($this->EE->input->post( 'loc' )),
          'reg_ip'=>$this->getRegIP()
          );
    
    
    
         $this->EE->session->set_flashdata('registrant', $flashdata);
         $this->EE->functions->redirect('/register/checkout/');

    and this is the checkout method…

    public function checkout() {
      $reg_info = $this->EE->session->flashdata(‘registrant’);
      $this->EE->session->set_flashdata(‘registrant’, $reg_info);

     

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases