JApplication/getUserState: Difference between revisions
From Joomla! Documentation
New page: ===Description===
Gets a user state.
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki>
<... |
No edit summary |
||
| Line 32: | Line 32: | ||
===Source Body=== | ===Source Body=== | ||
<source lang="php"> | <source lang="php"> | ||
function getUserState( $key ) | |||
{ | { | ||
$session = &JFactory::getSession(); | $session =& JFactory::getSession(); | ||
$registry = $session->get('registry'); | $registry =& $session->get('registry'); | ||
if (!is_null($registry)) { | if(!is_null($registry)) { | ||
return $registry->getValue($key); | return $registry->getValue($key); | ||
} | } | ||
Revision as of 22:09, 22 March 2010
Description
Gets a user state.
Template:Description:JApplication/getUserState
Syntax
getUserState($key)
| Parameter Name | Default Value | Description |
|---|---|---|
| $key | The path of the state. |
Returns
mixed The user state.
Defined in
libraries/joomla/application/application.php
Importing
jimport( 'joomla.application.application' );
Source Body
function getUserState( $key )
{
$session =& JFactory::getSession();
$registry =& $session->get('registry');
if(!is_null($registry)) {
return $registry->getValue($key);
}
return null;
}
[Edit See Also] Template:SeeAlso:JApplication/getUserState
Examples
<CodeExamplesForm />