API16

JApplication/setUserState: Difference between revisions

From Joomla! Documentation

m removing red link to edit, no existant pages
m clean up
Line 2: Line 2:
Sets the value of a user state variable.
Sets the value of a user state variable.


<span class="editsection" style="font-size:76%;">
 
<nowiki>[<! removed edit link to red link >]</nowiki>
</span>


<! removed transcluded page call, red link never existed >
<! removed transcluded page call, red link never existed >
Line 47: Line 45:
</source>
</source>


<span class="editsection" style="font-size:76%;">
 
<nowiki>[<! removed edit link to red link >]</nowiki>
</span>
<! removed transcluded page call, red link never existed >
<! removed transcluded page call, red link never existed >



Revision as of 13:38, 24 March 2017

Description

Sets the value of a user state variable.


<! removed transcluded page call, red link never existed >

Syntax

setUserState($key, $value)
Parameter Name Default Value Description
$key The path of the state.
$value The value of the variable.

Returns

mixed The previous state, if one existed.

Defined in

libraries/joomla/application/application.php

Importing

jimport( 'joomla.application.application' );

Source Body

public function setUserState($key, $value)
{
        $session        = &JFactory::getSession();
        $registry       = &$session->get('registry');
        if (!is_null($registry)) {
                return $registry->setValue($key, $value);
        }
        return null;
}


<! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />