code works well while logged in as admin other users dont run
Permalink
Hi
i wrote this ode on a single page and works well when i log in as admin
$u=new \User();
if($u->isRegistered()){
$ui=\UserInfo::getByID($u->getUserID());
$this->myui=$ui;
$color=$ui->getUserFavoriteColor();
$this->set('favorite_color',$color);
}
but when i log in as other created user the page is open but code gives error message says
Call to a member function getUserFavoriteColor() on a non-object
why code runs only with admin !?
thanks in advance.
i wrote this ode on a single page and works well when i log in as admin
$u=new \User();
if($u->isRegistered()){
$ui=\UserInfo::getByID($u->getUserID());
$this->myui=$ui;
$color=$ui->getUserFavoriteColor();
$this->set('favorite_color',$color);
}
but when i log in as other created user the page is open but code gives error message says
Call to a member function getUserFavoriteColor() on a non-object
why code runs only with admin !?
thanks in advance.
this line there is no problem
but very strange thing
i open the page again it works !!!!!
how that happens? i have no idea what going on !!!!
i did not change any thing at ALL
but very strange thing
i open the page again it works !!!!!
how that happens? i have no idea what going on !!!!
i did not change any thing at ALL
I realize after the fact now, this is 5.7 related. Great that its working now!
$ui=\UserInfo::getByID($u->getUserID());