protected function setFieldValue( $field, $fieldPostName )
    {
        $user = eZUser::currentUser();
        switch ( $field )
        {
            case 'email':
                if( !$user->isAnonymous() )
                {
                    $this->fieldValues[$field] = $user->attribute( 'email' );
                }
                else
                {
                    parent::setFieldValue( $field, $fieldPostName );
                }
                break;
            case 'notificationField':
                $http = eZHTTPTool::instance();
                $notification = false;
                if( $http->hasPostVariable( $fieldPostName ) && $http->postVariable( $fieldPostName ) == '1')
                {
                    $notification = true;
                }
                $this->fieldValues[$field] = $notification;
                break;
            default:
                parent::setFieldValue( $field, $fieldPostName );
                break;
        }
    }
protected function setFieldValue( $field, $fieldPostName )
    {
        $user = eZUser::currentUser();
        switch ( $field )
        {
            case 'email':
                if( !$user->isAnonymous() )
                {
                    $this->fieldValues[$field] = $user->attribute( 'email' );
                }
                else
                {
                    parent::setFieldValue( $field, $fieldPostName );
                }
                break;
            case 'notificationField':
                $http = eZHTTPTool::instance();
                $notification = false;
                if( $http->hasPostVariable( $fieldPostName ) && $http->postVariable( $fieldPostName ) == '1')
                {
                    $notification = true;
                }
                $this->fieldValues[$field] = $notification;
                break;
            default:
                parent::setFieldValue( $field, $fieldPostName );
                break;
        }
    }
protected function setFieldValue ( $ field , $ fieldPostName ) { $ user = eZUser :: currentUser ( ) ; switch ( $ field ) { case 'email' : if ( ! $ user -> isAnonymous ( ) ) { $ this -> fieldValues [ $ field ] = $ user -> attribute ( 'email' ) ; } else { parent :: setFieldValue ( $ field , $ fieldPostName ) ; } break ; case 'notificationField' : $ http = eZHTTPTool :: instance ( ) ; $ notification = false ; if ( $ http -> hasPostVariable ( $ fieldPostName ) && $ http -> postVariable ( $ fieldPostName ) == '1' ) { $ notification = true ; } $ this -> fieldValues [ $ field ] = $ notification ; break ; default : parent :: setFieldValue ( $ field , $ fieldPostName ) ; break ; } }
Implement the setFieldValue in adding comment
@see extension/ezcomments/classes/ezcomFormTool#setFieldValue($fieldPostName)
Implement the setFieldValue in adding comment