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.

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
var_dump(0 == "a"); // 0 == 0 -> true
(0 != "a") should evaluate false.

the code

code: select all

if ($current->id != $id)
comparing (0 != 'angrybird") , evaluate false. believe true evaluation required continue

code: select all

$instance = juser::getinstance($id);
'username' converted user's 'id' via user.php (getinstance()) , helper.php (getuserid()).

am interpreting correctly or missing something?






Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support