Skip to main content

How to access object values in Joomla session variable

How to access object values in Joomla session variable - $_SESSION['__default']

QUERY : in Joomla + i just echo 'ed the following
echo "
ses:
";print_r($_SESSION['__default']);echo "
";

it outputed like this
:


Array
(
    [session.counter] => 34
    [session.timer.start] => 1336983808
    [session.timer.last] => 1336986596
    [session.timer.now] => 1336987030
    [session.client.browser] => Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0
    [registry] => JRegistry Object
        (
            [data:protected] => stdClass Object
                (
                    [com_users] => stdClass Object
                        (
                            [registration] => stdClass Object
                                (
                                    [data] => Array
                                        (
                                            [name] => Jack
                                            [email1] => plus
                                            [email2] => admin
                                            [password1] => admin
                                            [password2] =>
                                            [template] => Green
                                            [username] => plus
                                        )

                                )

                        )

                )

        )

    [user] => JUser Object
        (
            [isRoot:protected] =>
            [id] => 0
            [name] =>
            [username] =>
            [email] =>
            [password] =>
            [password_clear] =>
            [usertype] =>
            [template] =>
            [block] =>
            [sendEmail] => 0
            [registerDate] =>
            [lastvisitDate] =>
            [activation] =>
            [params] =>
            [groups] => Array
                (
                )

            [guest] => 1
            [_params:protected] => JRegistry Object
                (
                    [data:protected] => stdClass Object
                        (
                        )

                )

            [_authGroups:protected] => Array
                (
                    [0] => 1
                )

            [_authLevels:protected] => Array
                (
                    [0] => 1
                    [1] => 1
                )

            [_authActions:protected] =>
            [_errorMsg:protected] =>
            [_errors:protected] => Array
                (
                )

            [aid] => 0
        )

    [session.token] => 594e2a13514957ea024b08a653dbfd96
)



--------------------

How to access only the following

[data] => Array
                                        (
                                            [name] => Jack
                                            [email1] => plus
                                            [email2] => admin
                                            [password1] => admin
                                            [password2] =>
                                            [template] => Green
                                            [username] => plus
                                        )

from that session ?




REPLY:


Try this:

$arr_data = $_SESSION['__default']['registry']->data;
print_r( $arr_data );


please post any other solutions to this


Urgent Openings for PHP trainees, Andriod / IOS developers and PHP developers in Kochi Trivandrum Calicut and Bangalore. Please Send Your updated resumes to recruit.vo@gmail.com   Read more »
Member
Search This Blog