[TYPO3-english] fe-plugin sessions problem

Simon Child simon at srchild.com
Tue Oct 28 23:21:00 CET 2008


I'm coding several fe-plugins, and using sessions to carry variables between 
the different plugins.

I'm having no problem reading data in one plugin that was written to 
another, but real problems trying to update the sessions.

I have no trouble writing to a session within a plugin. My problem seems to 
be when I want to update the data under the key of another plugin within a 
different one.

e.g., when within plugin tx_myanotherplugin_pi1, this doesn't seem to work, 
even though I have no problem writing the date originally and no problem 
reading it in. But even using storeSessionData(); the update doesn't get 
stored:

 $loginv = $GLOBALS["TSFE"]->fe_user->getKey('ses','tx_mylogin_pi1');
 unset($loginv['paid']);
 $loginv['paid']=$paid;
 unset($loginv['paidTo']);
 $loginv['paidTo']=$paidto;
 $GLOBALS["TSFE"]->fe_user->setKey('ses','tx_mylogin_pi1',$loginv);
 $GLOBALS["TSFE"]->storeSessionData();

$paid and $paidto are valid, I have just used them to successfully write to 
database, and then want to update the variables in the current session so 
that the next page refresh notices that the data has changed, but it 
doesn't. If on the next page I do:

$loginv = $GLOBALS["TSFE"]->fe_user->getKey('ses','tx_mylogin_pi1');
debug($loginv);

then  $loginv['paidTo'] and  $loginv['paidTo'] both show the old values.

I should be able to update the session data of one plugin from another, 
shouldn't I? (It seems to work sometimes, but not reliably).

What am I dong wrong?

Thanks

-- 
Simon Child




More information about the TYPO3-english mailing list