Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter puls13

    (@puls13)

    Hi Fabian,

    i would say:

    – create_forms
    – edit_forms
    – delete_forms
    – show_forms

    ?

    Best,
    Stephan.

    Thread Starter puls13

    (@puls13)

    Me again,

    i found a solution: I inserted a mail-field to the form. I pre-filled this field with the af/field/prefill_value filter. Which is working, perfect! And i changed the recipient to this field. Now it works!

    Thanks for your help and time,
    Stephan.

    Thread Starter puls13

    (@puls13)

    Hi @fabianlindfors ,

    thanks for your answer.

    Yes, 1338 is the ID of the form with the key form_5f1808c340797. I tried it, because the other one don’t work. I tried every version you described on the documentation. no one works. I tried to enter the mail directly, without call the function. I changed the mail-address. I wrote a new form, with only one text-input. Also don’t work.

    But, maybe we talk about different thinks?
    What i want is: In my notification options i selected “custom recipient” and inserted an adress. This mail works fine!
    And now i want to send the mail not only to this adress, but to another adress, which depends on an specific ACF-Field from the specific post (every post have his own e-mail).

    Maybe i understand the filter wrong?

    Best,
    Stephan.

    Thread Starter puls13

    (@puls13)

    Hi @fabianlindfors ,

    thanks for your answer, but…

    I take your code and insert it into my template:

    function filter_email_recipient( $recipient, $email, $form, $fields) {
    $recipient .= ', [email protected]';
    return $recipient;
    }
    
    add_filter('af/form/email/recipient/ID=1338', 'filter_email_recipient', 10, 4 );
    advanced_form('1338');

    Nothing.

    And: I also tested, if the filter works if i enter the email directly:
    add_filter('af/form/email/recipient/ID=1338', '[email protected]', 10, 4 );

    It also doesn’t work.

    πŸ™

    Thread Starter puls13

    (@puls13)

    Hi @fabianlindfors

    sorry for beeing a little bit annoying…

    At the moment, the filter don’t work. But i need the filter, because without the forms don’t work for me.

    Could you please help?

    Thanks
    Stephan.

    Thread Starter puls13

    (@puls13)

    Hi Fabian,

    here it is:

    /**
     * Return HTML (Text of Form)
     *
     * @param $method What should be printed?
     * @param $jobID The ID of the job
     * @param $company The ID of the company
     * @return string A HTML-Formated String
     */
    function PrintBewerbung($method, $jobID, $company) {
        $return = '';
        switch ($method) {
            case 'F': $return .= get_field('stelle_bewerben_freitext',$jobID);
                break;
            case 'U': setCompanyPersonMail($company); $return .= do_shortcode('[advanced_form form="form_5f1808c340797"]');
                break;
            default: $return .= get_field('stelle_bewerben_freitext',$jobID);
                break;
        }
     return $return;
    }
    
    /**
     * Get Mail from ACF
     *
     * @param $company
     * @return string
     */
    function setCompanyPersonMail($company) {
        // get email from acf-field
        //$mail = get_field('company_person_mail',$company);
        $mail = '[email protected]';
    add_filter('af/form/email/recipient/key=form_5f1808c340797', $mail, 10, 0 );
    }

    Thanks for your help.

    Stephan.

    Thread Starter puls13

    (@puls13)

    Hi Fabian,

    thanks for your answer. But, it doesn’t helped. Sorry.

    • Is there any possibily to see, that the filter sends the mail-adress to the function, which sends the mail? Some debug-options?
    • Maybe the format of the mail is wrong? If i hard-coded it, i take a string. i also tested an array. Nothing happend.
    • And i have a problem with your idea to replace the do_shortcode() function. Because the advanced_form() prints out the form immediatly. But i need it in a return. But there is no get_advanced_form(), right?

      Thanks
      Stephan.

    Thread Starter puls13

    (@puls13)

    In addition, because maybe it’s important:

    after adding the filter, i call the form with
    do_shortcode('[advanced_form form="FORM_KEY"');

    Stephan.

    • This reply was modified 5 years, 10 months ago by puls13.
    Thread Starter puls13

    (@puls13)

    Hi Joe,

    thanks for your answer. I looked at the plugins – didn’t know them before, thank you – but this is not the right one for me. Sadly, i have to look for another way… πŸ™

    Best
    Stephan.

Viewing 9 replies - 1 through 9 (of 9 total)