unsetting a Joomla session variable

4,026 views
Skip to first unread message

whiskeyJak

unread,
Jun 2, 2010, 9:56:58 AM6/2/10
to Joomla! General Development
I'm using a session variable to display a confirmation message after a
form has been submitted.

$session =& JFactory::getSession();
echo $session->get('confirmationMessage');

Currently I just set the confirmationMessage value to an empty string
after I display the message, but I'd rather remove it from memory
completely if I can.

Is there a Joomla equivilant to the PHP method of
unset($_SESSION['session_variable_name']); I'd rather stick within the
Joomla methodology for doing things if possible. But $session-
>unset('sessionVariableName'); just produces a fatal error.

David Barrett

unread,
Jun 2, 2010, 10:04:35 AM6/2/10
to joomla-de...@googlegroups.com
$session->clear('confirmationMessage');

http://api.joomla.org/Joomla-Framework/Session/JSession.html#clear

--
You received this message because you are subscribed to the Google Groups
"Joomla! General Development" group.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to
joomla-dev-gene...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/joomla-dev-general?hl=en-GB.

whiskeyJak

unread,
Jun 2, 2010, 10:16:29 AM6/2/10
to Joomla! General Development
thanks
Reply all
Reply to author
Forward
0 new messages