Results 1 to 5 of 5

Thread: Avatars

  1. #1
    User
    Join Date
    06-19-09.
    Posts
    417

    Default 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?

  2. #2
    User
    Join Date
    06-19-09.
    Posts
    328

    Default 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
    Consulenza Contao CMS https://www.intco.it

  3. #3
    User
    Join Date
    06-19-09.
    Posts
    417

    Default 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?

  4. #4
    User FloB's Avatar
    Join Date
    06-21-09.
    Posts
    157

    Default Re: Avatars

    According to his description directly into the method definition:
    Code:
       protected function validator($var)

  5. #5
    User
    Join Date
    06-19-09.
    Posts
    417

    Default 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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •