-
Avatars
Using TL 2.7
I get the follow error when editing a user profile:
Runtime notice: Declaration of AvatarWidget::validator() should be compatible with that of Widget::validator() in /var/www/html/system/modules/avatar/AvatarWidget.php on line 11
Any ideas how I can cure this?
-
Re: Avatars
The Widget::validator definition takes one argument but the AvatarWidget::validator takes no arguments
so you need to change the last with
Code:
protected function validator($varInput)
i.e. you need to add the "($varInput)" parameter to the AvatarWidget::validator
-
Re: Avatars
Hi, thanks for your help.
I can see the code:
Code:
protected function validator()
{
// check reset
if ($this->Input->post($this->strName . '_reset')) {
return '';
} // if
// check upload
$key = $this->strName.'_file';
if (!$_FILES || !array_key_exists($key, $_FILES) || !strlen($_FILES[$key]['name'])) {
return $this->varValue;
} // if
$fname = $_FILES[$key]['name'];
$tmp = $_FILES[$key]['tmp_name'];
// check for errors
$text = &$GLOBALS['TL_LANG']['avatar'];
$err = $_FILES[$key]['error'];
if ($err != UPLOAD_ERR_OK) {
switch ($err) {
case UPLOAD_ERR_INI_SIZE:
$this->addError(sprintf($text['errinisize'],$fname));
break;
case UPLOAD_ERR_FORM_SIZE:
$this->addError(sprintf($text['errformsize'],$fname));
break;
case UPLOAD_ERR_PARTIAL:
$this->addError(sprintf($text['errpartial'],$fname));
break;
case UPLOAD_ERR_NO_TMP_DIR:
$this->addError($text['notmpdir']);
break;
case UPLOAD_ERR_CANT_WRITE:
$this->addError(sprintf($text['cantwrite'],$fname));
break;
default:
$this->addError(sprintf($text['errorno'],$fname, $err));
break;
} // switch
return '';
} // if
But unsure how/where to put that parameter in?
-
Re: Avatars
According to his description directly into the method definition:
Code:
protected function validator($var)
-
Re: Avatars
Thanks, I think I was being particularly dense, and unfortunately I can't even blame it on the wine this time :-)
Works perfectly, thanks to you both.