Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #944650

    I haven’t been able to resolve this and I’m hoping someone can help out here.

    Using the forms in the Enfold theme, there’s a SUBJECT field you can fill out which comes through when a visitor fills out a form.
    I’m looking to dynamically add a bit of information to this for customer support purposes. We have a field within the form labeled “League Name”

    I’d like the subject of the email we receive to follow this format:
    SUBJECT – League Name
    where League Name is whatever the user types in.

    After some research with a programmer, it appears the file that needs to be adjusted may be:
    enfold > framework > php > class-form-generator-.php

    Can anyone lend a hand helping me accomplish this?

    #944887

    Hey davidm290,

    I think this can be accomplished without changing core files and just using hooks.
    Please try to check the solution posted on this thread: https://kriesi.at/support/topic/contact-form-subject-line-fill-with-text-field/
    Hope this helps :)

    Best regards,
    Nikko

    #945588

    Hey Nikko,
    i tried this and I’m still no getting this to work. I used the following:

    add_filter(‘avf_form_subject’,’avia_change_mail_subject’, 10, 3);
    function avia_change_mail_subject($subject, $new_post, $form_params) {
    $subject = urldecode($new_post[‘3_1’]);
    return $subject;
    }

    Except I changed…
    $subject = urldecode($new_post[‘3_1’]);
    to…
    $subject = urldecode($new_post[‘avia_4_1’]);

    I get (No Subject)

    I found this using the Developer Toolbar technique mentioned in one of those posts.
    I’m trying to get this working for a bunch of forms, but any chance you could help me get this working here first:
    Placing the link in private…

    • This reply was modified 6 years, 7 months ago by davidm290.
    #946419

    Hi davidm290,

    Try to replace this code:

    $subject = urldecode($new_post['avia_4_1']);

    with:

    $subject = urldecode($new_post['4_1']);

    Let us know if this helps :)

    Best regards,
    Nikko

    #946655

    Hey Nikko,
    I feel like we are almost there. This seemed to act like it normally would, meaning it provided the subject that was set in the avia form builder, but it did not append the League Name field content the user types in.

    Thoughts?

    #947044

    Hi davidm290,

    Can you post again what the new code looks like now?
    And also post here the result or what Subject you’re receiving.

    Best regards,
    Nikko

    #947062

    I just changed what you told me to:

    add_filter(‘avf_form_subject’,’avia_change_mail_subject’, 10, 3);
    function avia_change_mail_subject($subject, $new_post, $form_params) {
    $subject = urldecode($new_post[‘4_1’]);
    return $subject;
    }

    The subject comes through with just what we have set for the subject field…
    E-Mail Subject
    You can define a custom Email Subject for your form here. If left empty the subject will be: New Message (sent by contact form at XXX)

    This field currently has “New League Inquiry”

    #948807

    Hi davidm290,

    I have tested the same code on my end and it works fine, so I’m not really sure why it’s not working on your end.
    Can you try to give us temporary admin access? so we can check your backend settings.
    Just post the login details in private content.

    Best regards,
    Nikko

    #949112

    Hey Nikko,
    Thanks for looking into this, I”m going to leave a little more info in the private area as well.
    Thanks for your help.

    #949828

    Hi davidm290,

    Thanks for providing the admin access, I have added this code in your functions.php

    add_filter('avf_form_subject','avia_change_mail_subject', 10, 3);
    function avia_change_mail_subject($subject, $new_post, $form_params) {
        if( is_page( 5862 ) ):
        	$subject = urldecode($new_post['4_1']);
        endif;
        return $subject;
    }
    

    and tested it using my email, it worked properly. I have received in my email what I filled in the League Name field.
    Also if you can see in the code I have added

    if( is_page( 5862 ) ):

    where 5862 is the ID of the page where the form is located and thus this only works on the specific page.
    Let us know if this helps, if I might have misunderstood it, please let me know.

    Best regards,
    Nikko

    #950077

    Thanks Nikko, I see this works, but we are still missing one piece from the original question… This league name info needs to be appended to the SUBJECT from the admin area. So, if I typed “New League Signup” into the subject field in the admin area, I’d like the email to come through as: New League Signup – “League Name here”

    Nevermind… I went back and used the coding from another post to solve this:

    $subject = ‘New League Form – ‘ . urldecode($new_post[‘4_1’]);

    • This reply was modified 6 years, 6 months ago by davidm290.
    #950624

    Hi davidm290,

    Glad you got it working for you! :)

    If you need further assistance please let us know.

    Best regards,
    Victoria

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.