yii-user
yii-user copied to clipboard
widgetAttributes() not found when opening profile
Hi, I have just installed yii-user, and when I tried to register a user (which would access profiles, I would have the an error stating that widgetAttributes()
is not found.
This error is caught in UActiveRecord
class specifically in the setAttributes()
method.
Is this a bug or am I missing something?
For the time being I am checking whether that method is exist with method_exists
function and than dismiss it if its not found. I know its a rough fix but so far its running good. Anyone know any what that code parts is doing?
To be clear, here is my modified method:
public function setAttributes($values, $safeOnly = true) {
if(method_exists($this, "widgetAttribute"))
{
foreach ($this->widgetAttributes() as $fieldName => $className) {
if (isset($values[$fieldName]) && class_exists($className)) {
$class = new $className;
$arr = $this->widgetParams($fieldName);
if ($arr) {
$newParams = $class->params;
$arr = (array) CJavaScript::jsonDecode($arr);
foreach ($arr as $p => $v) {
if (isset($newParams[$p]))
$newParams[$p] = $v;
}
$class->params = $newParams;
}
if (method_exists($class, 'setAttributes')) {
$values[$fieldName] = $class->setAttributes($values[$fieldName], $this, $fieldName);
}
}
}
}
parent::setAttributes($values, $safeOnly);
}