Hi all
I'm doing a custom component, that would allow special users to log in to a private admin area. These users are not normal Joomla users, but exits in another table. Everything works, but I can't seem to do normal php-session stuff (like checking if a certain session variable exist and clear that variable on log-out - ie. unset($_SESSION['myVar']) etc. etc. ).
Is there special woodoo required for stuff like that in Joomla-land?
Thank you in advance!
Martin
Adding some variables to Joomla's session Topic is solved
Moderators: tjay, seadap, Rogue4ngel, matthewhayashida
Re: Adding some variables to Joomla's session
Hi, it's me again ....
I found this tutorial, that really is for Mambo 4.5.x (http://lists.nyphp.org/pipermail/joomla ... 00261.html).
So I went through the steps - expanded the session-table in the db with a test-column, added an identically named variable in joomla.php (around line 700, not 2037 as in Mambo.php).
Then in my component, I do this $mainframe->_session->myNewSessionVar ='test'; $mainframe->_session->update(); ?>.
So far so good. I can now print out that variable by adding echo $mainframe->_session->myNewSessionVar ?> somewhere in index.php for example.
BUT, when I go to another page, I can't read out the new variable.
I thought that new variable would be registered in the session and stay there as long as the session lives or until I unset it.
Any ideas?
Thanks in advance
Martin
(Using Joomla 1.0.11)
I found this tutorial, that really is for Mambo 4.5.x (http://lists.nyphp.org/pipermail/joomla ... 00261.html).
So I went through the steps - expanded the session-table in the db with a test-column, added an identically named variable in joomla.php (around line 700, not 2037 as in Mambo.php).
Then in my component, I do this $mainframe->_session->myNewSessionVar ='test'; $mainframe->_session->update(); ?>.
So far so good. I can now print out that variable by adding echo $mainframe->_session->myNewSessionVar ?> somewhere in index.php for example.
BUT, when I go to another page, I can't read out the new variable.
I thought that new variable would be registered in the session and stay there as long as the session lives or until I unset it.
Any ideas?
Thanks in advance
Martin
(Using Joomla 1.0.11)
Re: Adding some variables to Joomla's session
Try $mainframe->getUserState(), $mainframe->getUserStateFromRequest and $mainframe->setUserState().
Look at the includes/joomla.php for more information on these functions.
You have to put global $mainframe; at the top of your function.
Ian
Look at the includes/joomla.php for more information on these functions.
You have to put global $mainframe; at the top of your function.
Ian
Help test my Component XML Generator Tool!
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,1997/Itemid,35/
All feedback appreciated!
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,1997/Itemid,35/
All feedback appreciated!