JFactory::getUser() giving odd results - Joomla! Forum - community, help and support


i'm creating extension part of involves checking users id. run potential username through jfactory::getuser(); in example 2 here. code is

code: select all

$user_id=&jfactory::getuser($name);
if($user_id->id==0) {      //line 79
  $profile_link = $name;
} else {   
  $profile_link = '<a href="'.jroute::_('index.php?option=com_comprofiler&task=userprofile&user='.$user_id->id).'">' . $name . '</a>';
}
echo $profile_link;

just clarification i've selected out relevant part of code. can see if username valid user link community builder profile. else echo out name (this being run through foreach loop of list of names).

i'm running 2 issues - don't seem expected.

1. if name doesn't exist. joomla posting error in system messages area.

code: select all

juser: :_load: user xxxx not exist

there php error of (note i've pointed out line 79 in code above):

code: select all

notice: trying property of non-object in moduleroot/tmpl/default.php on line 79


2. if user logged out whether name valid or not joomla finds $user_id->id 0. despite documentation stating should run regardless of status of current user.

can see wrong code? or else know if standards of jfactory::getuser() have changed since documentation written joomla 2.5?






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