-
AuthorPosts
-
April 20, 2018 at 5:24 pm #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-.phpCan anyone lend a hand helping me accomplish this?
April 21, 2018 at 11:48 am #944887Hey 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,
NikkoApril 23, 2018 at 10:56 pm #945588Hey 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, 8 months ago by davidm290.
April 25, 2018 at 7:33 am #946419Hi 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,
NikkoApril 25, 2018 at 3:59 pm #946655Hey 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?
April 26, 2018 at 4:18 am #947044Hi 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,
NikkoApril 26, 2018 at 4:54 am #947062I 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”
April 30, 2018 at 7:08 am #948807Hi 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,
NikkoApril 30, 2018 at 4:28 pm #949112Hey 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.May 2, 2018 at 6:31 am #949828Hi 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 addedif( 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,
NikkoMay 2, 2018 at 2:39 pm #950077Thanks 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, 7 months ago by davidm290.
May 3, 2018 at 10:21 am #950624Hi davidm290,
Glad you got it working for you! :)
If you need further assistance please let us know.
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.