hnamd
(Mitra Handsomefriend)
July 5, 2012, 4:17pm
1
when i am using both extension Yii User and Rights than i will be not able to save my profile edit.
[size="4"]config main.php [/size][size="4"] componet like below for using rights plugin.[/size]
‘components’=>array(
'user'=>array(
'class'=>[b]'RWebUser',[/b]
'allowAutoLogin'=>true,
'loginUrl' => array('/user/login'),
),
now i am able to access all Rights extension related featurs but not able to save my profile edits. getting following error:-
[size="3"]CException[/size]
RWebUser and its behaviors do not have a method or closure named "updateSession".
C:\wamp\www\yii\framework\base\CComponent.php(266) 254 public function __call($name,$parameters) 255 { 256 if($this->_m!==null) 257 { 258 foreach($this->_m as $object) 259 { 260 if($object->getEnabled() && method_exists($object,$name)) 261 return call_user_func_array(array($object,$name),$parameters); 262 } 263 } 264 if(class_exists(‘Closure’, false) && $this->canGetProperty($name) && $this->$name instanceof Closure) 265 return call_user_func_array($this->$name, $parameters); 266 throw new CException(Yii::t(‘yii’,’{class} and its behaviors do not have a method or closure named “{name}”.’, 267 array(’{class}’=>get_class($this), ‘{name}’=>$name))); 268 }
…
…
[size="4"]Again when i changed my config main.php component to :[/size]
‘components’=>array(
'user'=>array(
'class'=>[b]'WebUser',[/b]
'allowAutoLogin'=>true,
'loginUrl' => array('/user/login'),
),
now i am able to save my profile edit but not able to access few of my my Rights plugin features.
Using Yii 1.1.10
Madi
(Fersi Madi)
July 6, 2012, 8:34am
2
I was facing the same problem as well.
The path to "localhost/testdrive/user/admin/update" works fine. But when I try to execute "localhost/testdrive/user/profile/edit" I get the same error mentioned above.
I was able to solve the problem by adding this function that I found under /modules/user/components/WebUser.php to the file /modules/rights/components/CWebUser.php
public function updateSession()
{
$user = Yii::app()->getModule('user')->user($this->id);
$userAttributes = CMap::mergeArray(array( 'email'=>$user->email,
'username'=>$user->username,
'create_at'=>$user->create_at,
'lastvisit_at'=>$user->lastvisit_at,
),$user->profile->getAttributes());
foreach ($userAttributes as $attrName=>$attrValue)
{
$this->setState($attrName,$attrValue);
}
}
Hope this helps.
praxus
(Praxus22)
July 19, 2012, 11:27am
4
Madi:
I was facing the same problem as well.
The path to "localhost/testdrive/user/admin/update" works fine. But when I try to execute "localhost/testdrive/user/profile/edit" I get the same error mentioned above.
I was able to solve the problem by adding this function that I found under /modules/user/components/WebUser.php to the file /modules/rights/components/CWebUser.php
Hope this helps.
Thanks Madi, this solved my problem as well. But I’m also curious as to why this happened.
Madi
(Fersi Madi)
July 20, 2012, 5:16pm
5
The excetion thrown says everything.
RWebUser is apparently missing the updateSession behaviour.
fleuryc
(Clement Fleury)
September 3, 2012, 1:18pm
6
Or, RWebUser can just extend WebUser from Yii_user ext by simply replacing in RWebUser (9) :
class RWebUser extends CWebUser
with :
class RWebUser extends WebUser
Cheers!
neorf
(Neorf3k)
October 17, 2012, 10:21am
7
i’ve added function updateSession() in /modules/rights/components/RWebUser.php, i don’t have /modules/rights/components/CWebUser.php
johnsnails
(Johnwales Jw)
September 24, 2013, 6:18am
8
I am in the same boat, no CWebUser. & when I added to RWebUser no luck :’(
Can we just copy/paste the SQL file under modules > rights > data > schema.sql ? Or is there more to the install process?
Cheers!
chupnik
(Chupnik)
February 19, 2014, 6:50pm
9
This problem has already been solved with CBehaviors in this github repo schmunk42/web-user-behavior