protected function validateUserIdAddress()
    {
        $field = 'user_id';

        if ($this->isExcluded($field)) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if ($this->isUpdating() && !isset($value)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $label = $this->translation->text('User');

        if (empty($value) || mb_strlen($value) > 255) {
            $this->setErrorLengthRange($field, $label);
            return false;
        }

        if (!is_numeric($value)) {
            return true; // Anonymous user
        }

        $user = $this->user->get($value);

        if (empty($user)) {
            $this->setErrorUnavailable($field, $label);
            return false;
        }

        return true;
    }
protected function validateUserIdAddress()
    {
        $field = 'user_id';

        if ($this->isExcluded($field)) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if ($this->isUpdating() && !isset($value)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $label = $this->translation->text('User');

        if (empty($value) || mb_strlen($value) > 255) {
            $this->setErrorLengthRange($field, $label);
            return false;
        }

        if (!is_numeric($value)) {
            return true; // Anonymous user
        }

        $user = $this->user->get($value);

        if (empty($user)) {
            $this->setErrorUnavailable($field, $label);
            return false;
        }

        return true;
    }
protected function validateUserIdAddress ( ) { $ field = 'user_id' ; if ( $ this -> isExcluded ( $ field ) ) { return null ; } $ value = $ this -> getSubmitted ( $ field ) ; if ( $ this -> isUpdating ( ) && ! isset ( $ value ) ) { $ this -> unsetSubmitted ( $ field ) ; return null ; } $ label = $ this -> translation -> text ( 'User' ) ; if ( empty ( $ value ) || mb_strlen ( $ value ) > 255 ) { $ this -> setErrorLengthRange ( $ field , $ label ) ; return false ; } if ( ! is_numeric ( $ value ) ) { return true ; // Anonymous user } $ user = $ this -> user -> get ( $ value ) ; if ( empty ( $ user ) ) { $ this -> setErrorUnavailable ( $ field , $ label ) ; return false ; } return true ; }
Validates a user Id
@return boolean
Validates a user Id