-
AuthorPosts
-
July 11, 2014 at 8:45 am #289936
Hi..
I need to have some indicator text inside the email or subject.
I tried to set E-mail Subject, but what i get is just the subject from the contact form.
I tried to use custom HTML, it’s in the form but not showed in the email.
How to do?Thanks
July 11, 2014 at 3:46 pm #290141Hi dewasurya!
Do you mean placeholder? If so, please add following code to Functions.php file inside Appearance > Editor
function add_custom_script(){ ?> <script> jQuery(window).load(function(){ jQuery('input#avia_name_1').attr('placeholder', 'Name *'); jQuery('input#avia_e-mail_1').attr('placeholder', 'E-mail *'); jQuery('textarea#avia_message_1').attr('placeholder', 'Your message *'); jQuery('input#avia_subject_1').attr('placeholder', 'Your subject *'); }); </script> <?php } add_action('wp_footer', 'add_custom_script');
Regards,
YigitJuly 14, 2014 at 4:10 am #290866Hi,
I might do something wrong. Once I paste the code it makes my sites blank. Please have a try with the login info i gave you.
Thanks,
SuryaJuly 14, 2014 at 10:51 am #290925Hey Surya!
Please check your website now. I have successfully added the code to functions.php file
Best regards,
YigitJuly 14, 2014 at 11:11 am #290941Hi..
Thank you,
so how this is work? I just tried to send an email, but there is no indicator showing that it is came from this contact form.Name: test4
E-Mail: (Email address hidden if logged out)
Subject: testing email subject 4Message: test ajaahhh
I need something written inside the email that I receive. For example under the message there is always text says “email from contact us”. Then in another contact form in different page, there is another text says something else. Therefore I can give indicator which email came from which contact form
July 15, 2014 at 6:13 pm #291734Hi!
Please try to insert this cpode into the enfold/functions.php file – it should change the subject to “New message sent by contact form at XXX” and instead of XXX the page title of the contact form page will be used.
add_filter('avf_form_subject', 'avia_change_subject', 10, 3); function avia_change_subject($subject, $new_post, $params){ $subject = __("New Message", 'avia_framework') . " (".__('sent by contact form at','avia_framework')." ".get_the_title().")"; return esc_html($subject); }
Best regards,
PeterJuly 16, 2014 at 5:46 am #291954Hi Peter,
Thank you for your help. But it change the mail subject completely, and each new message always has the same subject. This is not what I mean. Sorry for the confusion.
If you see contact form 7. you can define some text in message body:
—
This e-mail was sent from a Promo Blast on Villa Bugis (http://villabugis.com)The same with this, I need to add some text after all message defined by all fields in your contact form. I don’t want to use contact form 7 as contact form 7 could not redirect the page to another page after submit.
Sorry for my bad English, hope you understand.
Regards,
SuryaJuly 17, 2014 at 12:02 am #292303Hi Surya,
Open /framework/php/class-form-generator.php and look for line 713:
$message = stripslashes($message);
Replace it by this:
$message = apply_filters("avf_form_message", stripslashes($message), $new_post, $this->form_params);
Then add this to the theme functions.php:
function change_form_message($message) { $message .= "<br>- This e-mail was sent from a Promo Blast on Villa Bugis (http://villabugis.com)"; return $message; } add_filter('avf_form_message', 'change_form_message');
Change as needed.
Regards,
JosueJuly 18, 2014 at 3:06 am #292776Hi Josue,
Thank you.
It works, however, it just work if I change the class-form-generator.php in the main theme. I can’t apply it from child theme? I’m afraid it will gone in the next theme update.
And as the additional message is set in function.php, it apply for all contact form in all pages, we need to make the text different, depend on the page. Is that possible?Regards,
SuryaJuly 19, 2014 at 8:59 am #293281Hey!
You can copy the entire code of /framework/php/class-form-generator.php into your child theme functions.php file. Then the next theme update won’t overwrite your modified code.
Regards,
PeterJuly 19, 2014 at 9:04 am #293282Hey!
If you want to set a different message for different pages try to use the is_page() conditional: http://codex.wordpress.org/Function_Reference/is_page
Use it like
function change_form_message($message) { $message .= "<br>- This is the standard message which will be used if no condition applies (http://villabugis.com)"; if(is_page(42)) $message .= "<br>- This e-mail was sent from a Promo Blast on Villa Bugis (http://villabugis.com)"; if(is_page(45)) $message .= "<br>- This e-mail was sent from a another page (http://villabugis.com)"; if(is_page(50)) $message .= "<br>- This e-mail was sent from yet another page (http://villabugis.com)"; return $message; } add_filter('avf_form_message', 'change_form_message');
The first message will be used if the message was not send from a contact form on page 42 or 45 or 50. If a contact form on page 42, 45, 50 is used the message will change. You can replace the message strings with your custom text and change the page ids (42, 45, 50) to the page ids of your contact form pages.
Regards,
PeterAugust 11, 2014 at 5:34 am #302407Hi Dude,
Thank you so much for your help. It’s a charm!
I have now some similar thing but in the different level, please advise if you could help.
I have set some parameters in the front page using plugin insert php, to catch the source of the person who contact us, to know that our adwords is worth or not.
here is the parameters:
[insert_php]
@session_start();
if(isset($_SESSION[‘src’]) && isset($_SESSION[‘adid’])) {
$_SESSION[‘src’] = $_GET[‘src’];
$_SESSION[‘adid’] = $_GET[‘adid’];
} else {
$_SESSION[‘src’] = ”;
$_SESSION[‘adid’] = ”;
}
[/insert_php]Then I need the text in the message to be the result of the parameters instead of the current plain text message:
session_start();
$_SESSION[‘src’] = $_GET[‘src’];
$_SESSION[‘adid’] = $_GET[‘adid’];
echo “SRC= “.$_SESSION[‘src’].” ADID= “.$_SESSION[‘adid’];Please help if possible.
Regards,
SuryaAugust 12, 2014 at 7:29 am #303005Hey Surya!
Try putting the session code in the functions.php alongside the change_form_message function.
Regards,
JosueAugust 18, 2014 at 3:38 am #305525Hi Josue,
Thank you.
I tried couple ways putting the codes, but ended with blank page.We like to have something like this inside the Email Form:
[insert_php]
session_start();
echo “SRC= “.$_SESSION[‘src’].” ADID= “.$_SESSION[‘adid’];
$ip = getenv(‘REMOTE_ADDR’);
$time = date(“M j G:i:s Y”);
$fwrite=fopen(“/home/villabug/public_html/wp-content/prospects.txt”,”a+”);
fwrite($fwrite, “T=”.$time.”\t IP=”.$ip.”\t EMAIL= SOURCE=”.$_SESSION[‘src’].” ADID=”.$_SESSION[‘adid’].”\n”);
fclose($fwrite);
[/insert_php]Hhow we can assign the EMAIL address that’s captured on http://villabugis.com/contact-us/ to a PHP session variable e.g. $_SESSION[’email’]?
Regards,
SuryaAugust 18, 2014 at 3:47 am #305526Hey Surya!
This could work:
$_SESSION['email'] = $_POST['avia_e-mail_1'];
Regards,
JosueAugust 18, 2014 at 10:01 am #305600Hi Josue,
Could you please let me know where this code should exactly should be located?Thanks,
SuryaAugust 18, 2014 at 8:42 pm #305978Hi Surya!
Hm, i couldn’t tell to be honest because i did not craft that custom code and i don’t know what exactly it does, i’ve just answered to:
how we can assign the EMAIL address that’s captured on http://villabugis.com/contact-us/ to a PHP session variable e.g. $_SESSION[’email’]?
Best regards,
JosueAugust 19, 2014 at 10:06 am #306163Hi Josue,
Sorry for being pain.
Actually we would like to track the source from where they find our website. We need to grab the cookies and insert it inside the email that visitor submitted from your contact form.
We have manage to write some texts in the contact form, but now we would like to replace the text with the cookies, then we are able to get the tracking for every conversion.If I may ask, how we can output the content from the Contact Us form to a local file at the same time as generating an email to our email address? So we dont need to assign email to PHP, and we just need to write the content to a file which will include the email (plus name, subject, message)?
Or do you have any other suggestion?
Thank you.
SuryaAugust 19, 2014 at 9:08 pm #306521Hello Surya,
To set a cookie you can use the setcookie function. It’s worth noting that this request has already gone outside the support coverage we can offer, if you need additional help please contact a developer from Codeable or Envato Studio.
Best regards,
JosueSeptember 27, 2014 at 6:40 am #325885Thanks so much I chose the script that @Dude put up and it worked like a charm now all forms in the widget section show the page they came from I LOVE ENFOLD
-
AuthorPosts
- The topic ‘Contact form Indicator’ is closed to new replies.