JFactory::getUser() with username - Joomla! Forum - community, help and support
hello,
newbie here.
joomla! 2.5.8 - platform 11.4.0
php 5.4.8
i trying access user's information based on username. using following user object.
per joomla! docs-
my code above not user's information.
by examining getuser() code in factory.php, string parameters, execution gets
per operators comparison docs on php.net,
an example indicates
the code comparing (0 != 'angrybird") , evaluate false. believe true evaluation required continue 'username' converted user's 'id' via user.php (getinstance()) , helper.php (getuserid()).
am interpreting correctly or missing something?
newbie here.
joomla! 2.5.8 - platform 11.4.0
php 5.4.8
i trying access user's information based on username. using following user object.
code: select all
$getuser = jfactory::getuser('angrybird');per joomla! docs-
if string passed interpreted user name , converted integer id automatically.
my code above not user's information.
by examining getuser() code in factory.php, string parameters, execution gets
.if ($current->id != $id)
code: select all
public static function getuser($id = null)
{
if (is_null($id))
{
$instance = self::getsession()->get('user');
if (!($instance instanceof juser))
{
$instance = juser::getinstance();
}
}
else
{
$current = self::getsession()->get('user');
if ($current->id != $id)
{
$instance = juser::getinstance($id);
}
else
{
$instance = self::getsession()->get('user');
}
}
return $instance;
}per operators comparison docs on php.net,
if compare number string or comparison involves numerical strings, each string converted number , comparison performed numerically.
an example indicates
(0 != "a") should evaluate false.var_dump(0 == "a"); // 0 == 0 -> true
the code
code: select all
if ($current->id != $id)code: select all
$instance = juser::getinstance($id);am interpreting correctly or missing something?
please check url http://docs.joomla.org/jfactory/getuser
Comments
Post a Comment