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>
<... |
m preparing for archive only |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
Gets a user state. | Gets a user state. | ||
<! removed transcluded page call, red link never existed > | |||
===Syntax=== | ===Syntax=== | ||
Line 32: | Line 30: | ||
===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); | ||
} | } | ||
Line 43: | Line 41: | ||
</source> | </source> | ||
<! removed transcluded page call, red link never existed > | |||
< | |||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=getUserState | category=getUserState | ||
category=JApplication | category=JApplication | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
[[Category:Archived pages API15]] |
Latest revision as of 00:16, 25 March 2017
Description
Gets a user state.
<! removed transcluded page call, red link never existed >
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;
}
<! removed transcluded page call, red link never existed >
Examples
Code Examples