I try to fetch my users information using the getUser() function with a php script located in a iframe (wrapper) of Joomla. It seems there is problem passing parameters to iframe code. The only way I can catch user informations is to insert the code into a basic article (which is not an iframe).
The var_dump($user); output shows :
object(JUser)#17 (23) { ["isRoot":protected]=> NULL ["id"]=> int(0) ["name"]=> NULL ["username"]=> NULL ["email"]=> NULL ["password"]=> NULL ["password_clear"]=> string(0) "" ["usertype"]=> NULL ["block"]=> NULL ["sendEmail"]=> int(0) ["registerDate"]=> NULL ["lastvisitDate"]=> NULL ["activation"]=> NULL ["params"]=> NULL ["groups"]=> array(0) { } ["guest"]=> int(1) ["_params":protected]=> object(JRegistry)#18 (1) { ["data":protected]=> object(stdClass)#19 (0) { } } ["_authGroups":protected]=> NULL ["_authLevels":protected]=> NULL ["_authActions":protected]=> NULL ["_errorMsg":protected]=> NULL ["_errors":protected]=> array(0) { } ["aid"]=> int(0) }
Some idea of what is going wrong ? Thank you, Florent
<?php
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(__FILE__) );
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$user = JFactory::getUser();
echo "<p>Your name is {$user->name}, your email is {$user->email}, and your username is $user->username}</p>";
echo "<p>Your usertype is {$user->usertype} which has a group id of {$user->gid}.</p>";
//var_dump($user);
?>