Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dúvida com Odin_Contact_Form #397

Closed
threze opened this issue May 19, 2016 · 8 comments
Closed

Dúvida com Odin_Contact_Form #397

threze opened this issue May 19, 2016 · 8 comments

Comments

@threze
Copy link

threze commented May 19, 2016

Boa noite, pessoal, estou utilizando a classe Odin_Contact_Form pela primeira vez, utilizei o exemplo completo da página da documentação:

function odin_contact_form() {
    $form = new Odin_Contact_Form(
        'contact_form', // ID do formulário
        '[email protected]' // E-mail do destinatário.
        //array( '[email protected]', '[email protected]' ), // array com e-mails que receberão cópia.
        //array( '[email protected]' ) // array com e-mails que receberão cópia oculta.
        // array( 'class' => 'form' ) // array com atributos para o formulário.
        // 'file' // string com método que será enviado o anexo, no caso 'file' como anexo e 'url' para enviar links.
    );

    $form->set_fields(
        array(
            array(
                'fields' => array(
                    array(
                        'id'          => 'sender_name', // Obrigatório
                        'label'       => array(
                            'text'  => __( 'Nome Completo', 'odin' ), // Obrigatório
                            'class' => 'example-class example-class-2'
                        ),
                        'type'        => 'text', // Obrigatório
                        'required'    => true, // Opcional (bool)
                        'attributes'  => array( // Opcional (html input elements)
                            'placeholder' => __( 'Digite o seu nome' )
                        )
                    ),
                    array(
                        'id'          => 'sender_email', // Obrigatório
                        'label'       => array(
                            'text'  => __( 'E-mail', 'odin' ), // Obrigatório
                            'class' => 'example-class example-class-2'
                        ),
                        'type'        => 'email', // Obrigatório
                        'required'    => true, // Opcional (bool)
                        'attributes'  => array( // Opcional (html input elements)
                            'placeholder' => __( 'Digite o seu e-mail!' )
                        ),
                        'description' => __( 'Adicione um endereço de e-mail válido', 'odin' ) // Opcional
                    ),
                    array(
                        'id'          => 'sender_phone', // Obrigatório
                        'label'       => array(
                            'text'  => __( 'Telefone', 'odin' ), // Obrigatório
                            'class' => 'example-class example-class-2'
                        ),
                        'type'        => 'text', // Obrigatório
                        'required'    => true, // Opcional (bool)
                        'attributes'  => array( // Opcional (html input elements)
                            'placeholder' => __( 'Digite o seu Telefone' )
                        ),
                        'description' => __( 'Adicione um endereço de e-mail válido', 'odin' ) // Opcional
                    ),
                    array(
                        'id'          => 'sender_message', // Obrigatório
                        'label'       => array(
                            'text'  => __( 'Mensagem', 'odin' ), // Obrigatório
                            'class' => 'example-class example-class-2'
                        ),
                        'type'        => 'textarea', // Obrigatório
                        'required'    => true, // Opcional (bool)
                        'attributes'  => array( // Opcional (html input elements)
                            'placeholder' => __( 'Digite a sua mensagem' )
                        ),
                    ),
                )
            )
        )
    );

    $form->set_subject( __( 'Email enviado [sender_name] <[sender_email]>', 'odin' ) );

    $form->set_content_type( 'html' );

    $form->set_reply_to( 'sender_email' );

    return $form;

}

add_action( 'init', array( odin_contact_form(), 'init' ), 1 );

Porém ao enviar os dados pelo formulário, não está vindo os dados dos "fields" criados na mensagem. O conteúdo da mensagem chega vazio.

Desde já agradeço as respostas e instruções.

@threze threze changed the title Dúvida com Odin_Contact_Form Dúvida com Odin_Contact_Form label:question May 20, 2016
@threze threze changed the title Dúvida com Odin_Contact_Form label:question Dúvida com Odin_Contact_Form label:questionquestion May 20, 2016
@threze threze changed the title Dúvida com Odin_Contact_Form label:questionquestion Dúvida com Odin_Contact_Form May 20, 2016
@threze
Copy link
Author

threze commented May 22, 2016

Pessoal, alguém tem alguma sugestão?

1 similar comment
@threze
Copy link
Author

threze commented Jun 6, 2016

Pessoal, alguém tem alguma sugestão?

@adammacias
Copy link
Member

Amigo, copiei e colei o exemplo da nossa wiki e parece realmente ter algo errado. Nos resta debuggar esta classe e wiki.

@threze
Copy link
Author

threze commented Jun 7, 2016

Obrigado!

@williambeto
Copy link

Olá, alguém já tem solução pra esse bug?

@AdsonCicilioti
Copy link
Contributor

Acabei de me deparar com ele aqui... ainda não faço idéia como resolver. :(
Devido a urgência do projeto vou usar um plugin.

@AdsonCicilioti
Copy link
Contributor

AdsonCicilioti commented Aug 21, 2016

INFO: Comparei o arquivo da Class com outro de um site que já está no ar com uma versão mais antiga do Odin, e os arquivos da Class são idênticos.
E o form tá funfando de boas.. Email chegando tranquilo e sem erro.
Isso nos leva a entender que o bug está sendo causado por outra coisa, uma dependência ou ambiente do server.

Estou desenvolvendo em ambiente local com nginx e hhvm e com o SMTP externo configurado para envio de todos emails do WP, ... Não recebi o erro, porém o email não chega.

Quando tento o mesmo projeto numa hospedagem com apache e php5.4 me deparo com o bug.

@AdsonCicilioti
Copy link
Contributor

AdsonCicilioti commented Aug 21, 2016

Fiz uns teste e está constatado que as ultimas atualizações do abstract-front-end-form.php que habilitam atributos do label por array de alguma forma geram este bug... Voltei pra versão anterior e tudo funcionando té que consigamos resolver isso.

@adammacias adammacias added this to the v.2.4.0 milestone Oct 7, 2016
adammacias added a commit that referenced this issue Dec 3, 2016
Fix Contact form Bugs - labels and upload error ( #317, #397, #321 and #430 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants