Home › Forums › Quform WordPress › URGENT email-content.php from V1 to V2
- This topic has 20 replies, 2 voices, and was last updated 7 years ago by
Ally.
- AuthorPosts
- August 27, 2018 at 9:20 pm #26848
gbretin-22
ParticipantHello,
I own 2 quform licences a just renew the licence i am working with (it’s local dev).Could you please provide an up-to-date custom email-content.php for V2 !! The V1 custom code for custom email-content.php was working perfectly but now it’s a real nightmare. Been loossing a huge amount of time on this and tried everything i saw here on forum or on codecanyon :
the working code was the following :
<?php // setlocale(LC_TIME, 'fr_FR.UTF8'); // setlocale(LC_TIME, 'fr_FR'); // setlocale(LC_TIME, 'fr'); setlocale(LC_TIME, 'fr_FR'); date_default_timezone_set('Europe/Paris'); echo strftime('%A %d %B %Y - %H:%M'); // jeudi 11 octobre 2012, 16:03 ?> <?php if (!defined('IPHORM_VERSION')) exit; ?> <?php echo esc_html($mailer->Subject); ?> <?php $elements = $form->getElements(); foreach ($elements as $element) : ?> <?php if (!$element->isHidden() && (!$element->isEmpty() || ($element->isEmpty() && $form->getNotificationShowEmptyFields()))) : ?> <?php if ($element instanceof iPhorm_Element_Groupstart) : ?> <?php if ($element->getShowNameInEmail() && strlen($adminTitle = $element->getAdminTitle())) : ?> <?php echo esc_html($adminTitle); ?> <?php endif; ?> <?php else : ?> <?php echo esc_html($element->getAdminLabel()); ?> <?php echo $element->getValueHtml(); ?> <?php endif; ?> <?php endif; ?> <?php endforeach; ?> <?php echo date("Y"); ?>
THANK YOU VERY MUCH to reply me AS FAST AS POSSIBLE and give a valid php code for V2 version
PS 1 : This code should really appears on V2 documentation (the V1 has it) or, at least, on github…
PS 2 : Of course, i tried to update php from v1 to v2 like “iPhorm_Element_Groupstart” to “Quform_Element_Group” and tried a lot of github codes…August 28, 2018 at 9:31 pm #26851gbretin-22
ParticipantHello, any news on this ?
Our agency have more than 90 complex forms on this new website so it’s much easier for us to use a custom email-content.php with mixed HTML & PHP (like we used to do in V1 and it was perfect).
All we need is a valid QUFORM V2 version of the Quform WordPress email-html.php code (was V1 at the time) that you can find on your github (https://gist.github.com/ThemeCatcher/d3214ef92ba53ce939c3)
It helps us a lot because it gets all form values without showing the empty ones (it’s like the {all_form_data} shortcode in fact, but for the php custom version.
THANK YOU VERY VERY MUCH TO REPLY US ASAP, our customer will come to see us in less than 24 hours now…
Hoping to read you really soon !! Best regards
PS : We added the PHP code for date because everything has changed for this also and the code isn’t working anymore with new v2…
August 29, 2018 at 3:54 pm #26863Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- This reply was modified 7 years ago by
Ally. Reason: Fix the code to show group label
August 30, 2018 at 12:25 am #26869gbretin-22
ParticipantHello Ally,
Thank you very much for your reply. We think there is an error in the code for the custom plugin (but we don’t know anything in PHP so we could have made a stupid error on our side….) .
SO, here is the issue we encounter : when we copy/paste the code you gave us for the custom plugin, our whole website become blank and we can’t even access wordpress anymore (we checked the origin of the issue by reverting back to old custom plugin code and we were able to access everything back again).
Here is the code we entered in our “quform-custom-code.php” file that breaks everyting (we’re noobs, must have made a stupid error… sorry for that) :
<?php /* * Plugin Name: Quform Custom Code * Description: Custom code for Quform. * Version: 1.0 */ // Paste in your custom code below // QUFORM email custom //////////// function my_custom_notification_content(PHPMailer $mailer, Quform_Notification $notification, Quform_Form $form) { ob_start(); include __DIR__ . '/email-content.php'; $mailer->Body = ob_get_clean(); } add_action('quform_pre_send_notification_4_1', 'my_custom_notification_content', 10, 3); // QUFORM email autoreply //////////// function my_custom_notification_content(PHPMailer $mailer, Quform_Notification $notification, Quform_Form $form) { ob_start(); include __DIR__ . '/autoreply-content.php'; $mailer->Body = ob_get_clean(); } add_action('quform_pre_send_autoreply_4_2', 'my_custom_notification_content', 10, 3);
and here is the older code that doesn’t break anything BUT IS NOT THE RIGHT SOLUTION FOR US (see below why…)
<?php /* * Plugin Name: Quform Custom Code * Description: Custom code for Quform. * Version: 1.0 */ // Paste in your custom code below // QUFORM email custom //////////// add_action('quform_pre_send_notification_4_1', function (PHPMailer $mailer, Quform_Notification $notification, Quform_Form $form) { ob_start(); include __DIR__ . '/email-content.php'; $mailer->Body = ob_get_clean(); }, 10, 3); // QUFORM email autoreply //////////// add_action('quform_pre_send_autoreply_4_2', function (PHPMailer $mailer, Quform_Notification $notification, Quform_Form $form) { ob_start(); include __DIR__ . '/autoreply-content.php'; $mailer->Body = ob_get_clean(); }, 10, 3);
NOT CONVENIENT AT ALL BECAUSE we would like to be able to add the right lines at the end of the code for each form (we got more than 90 !!) like this :
add_action('quform_pre_send_notification_4_1', 'my_custom_notification_content', 10, 3); add_action('quform_pre_send_notification_5_1', 'my_custom_notification_content', 10, 3); add_action('quform_pre_send_notification_6_1', 'my_custom_notification_content', 10, 3); add_action('quform_pre_send_notification_7_1', 'my_custom_notification_content', 10, 3);
Hope to read you as soon as possible !! Thank you very much again AND sorry for being so bad at PHP….
Waiting impatiently !! Best regards
August 30, 2018 at 12:54 am #26870gbretin-22
ParticipantHello Ally again,
Beside our first issue (concerning the “quform-custom-code.php”), we did test the code you gave us for email-content.php (with the old version of “quform-custom-code.php” just to see if infos were passing right into e-mails) and everything works (thank you for that !!) BUT all the infos appears inline without any break between each of them.
It appears like this in the e-mail :
email : johndoe@gmail.com first name : john surname : doe
And we must make it appear with line breaks (like V1 did beautifully) because we have A LOT of infos for each form (please see below how we would like it to appear) :
email : johndoe@gmail.com first name : john surname : doe
and if each subject could be in bold (like V1 did), then it would be the paradise on earth (see below) :
email : johndoe@gmail.com
first name : john
surname : doeAgain, thank you so much for your help.
Waiting impatiently for your answers !! Best regards
August 31, 2018 at 10:03 pm #26877gbretin-22
ParticipantHello again,
Still no reply…
To help formatting CSS like V1 did beautifully, here is the piece of code mixing PHP and CSS that was working perfectly with QUFORM V1 :
`<!– 1/1 Text start –><table width=”600″ cellpadding=”0″ cellspacing=”0″ class=”wrap” style=”border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;color:#353535;font-family:Helvetica,Arial,sans-serif;font-size:12px”><tr style=”padding:0″>
<td valign=”top” style=”border-collapse:collapse;color:#353535;line-height:20px;padding:0″>
<table width=”100%” cellpadding=”0″ cellspacing=”0″ style=”border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;color:#353535;font-family:Helvetica,Arial,sans-serif;font-size:12px”><tr style=”padding:0″>
<!– CONTENT start –><td valign=”top” align=”left” style=”border-collapse:collapse;color:#353535;line-height:20px;padding:0″>
<div><p style=”margin:1em 0;color:#353535;line-height:20px”>
<?php if (!defined(‘IPHORM_VERSION’)) exit; ?>
<table width=”100%” cellpadding=”0″ cellspacing=”0″ border=”0″>
<tr>
<td valign=”top” style=”padding: 25px;”><table width=”600″ cellpadding=”0″ cellspacing=”0″ border=”0″ style=”font: 12px Arial, sans-serif;”>
<tr>
<td valign=”top” style=”font-family: Arial, sans-serif; font-size: 12px; font-weight: bold; color: #282828; padding-bottom: 10px;”><?php echo esc_html($mailer->Subject); ?></td>
</tr>
<tr>
<td valign=”top”><table width=”100%” border=”0″ cellpadding=”2″ cellspacing=”0″>
<?php
$elements = $form->getElements();
foreach ($elements as $element) : ?>
<?php if (!$element->isHidden() && (!$element->isEmpty() || ($element->isEmpty() && $form->getNotificationShowEmptyFields()))) : ?>
<?php if ($element instanceof iPhorm_Element_Groupstart) : ?>
<?php if ($element->getShowNameInEmail() && strlen($adminTitle = $element->getAdminTitle())) : ?>
<tr>
<td colspan=”2″ valign=”top” style=”font-family: Arial, sans-serif; font-size: 16px; font-weight: bold; color: #282828; padding-top: 15px; padding-bottom: 10px;”><?php echo esc_html($adminTitle); ?></td>
</tr>
<?php endif; ?>
<?php else : ?>
<tr>
<td valign=”top” style=”font-family: Arial, sans-serif; font-size: 12px; font-weight: bold; color: #282828; width: 45%;”><?php echo esc_html($element->getAdminLabel()); ?></td>
<td valign=”top” style=”font-family: Arial, sans-serif; color: #282828; line-height: 130%; width: 70%;”>
<?php echo $element->getValueHtml(); ?>
</td>
</tr>
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
</table></td>
</tr></table></td></tr></table>
</p></div>
</td>
<!– CONTENT end –>
</tr></table>
</td>
</tr></table>`Hope to have answers very very soon for my questions.
Best regards
August 31, 2018 at 10:05 pm #26878gbretin-22
Participantbackticks didn’t work… here we go again :
<!-- 1/1 Text start --><table width="600" cellpadding="0" cellspacing="0" class="wrap" style="border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;color:#353535;font-family:Helvetica,Arial,sans-serif;font-size:12px"><tr style="padding:0"> <td valign="top" style="border-collapse:collapse;color:#353535;line-height:20px;padding:0"> <table width="100%" cellpadding="0" cellspacing="0" style="border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;color:#353535;font-family:Helvetica,Arial,sans-serif;font-size:12px"><tr style="padding:0"> <!-- CONTENT start --><td valign="top" align="left" style="border-collapse:collapse;color:#353535;line-height:20px;padding:0"> <div><p style="margin:1em 0;color:#353535;line-height:20px"> <?php if (!defined('IPHORM_VERSION')) exit; ?> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td valign="top" style="padding: 25px;"><table width="600" cellpadding="0" cellspacing="0" border="0" style="font: 12px Arial, sans-serif;"> <tr> <td valign="top" style="font-family: Arial, sans-serif; font-size: 12px; font-weight: bold; color: #282828; padding-bottom: 10px;"><?php echo esc_html($mailer->Subject); ?></td> </tr> <tr> <td valign="top"><table width="100%" border="0" cellpadding="2" cellspacing="0"> <?php $elements = $form->getElements(); foreach ($elements as $element) : ?> <?php if (!$element->isHidden() && (!$element->isEmpty() || ($element->isEmpty() && $form->getNotificationShowEmptyFields()))) : ?> <?php if ($element instanceof iPhorm_Element_Groupstart) : ?> <?php if ($element->getShowNameInEmail() && strlen($adminTitle = $element->getAdminTitle())) : ?> <tr> <td colspan="2" valign="top" style="font-family: Arial, sans-serif; font-size: 16px; font-weight: bold; color: #282828; padding-top: 15px; padding-bottom: 10px;"><?php echo esc_html($adminTitle); ?></td> </tr> <?php endif; ?> <?php else : ?> <tr> <td valign="top" style="font-family: Arial, sans-serif; font-size: 12px; font-weight: bold; color: #282828; width: 45%;"><?php echo esc_html($element->getAdminLabel()); ?></td> <td valign="top" style="font-family: Arial, sans-serif; color: #282828; line-height: 130%; width: 70%;"> <?php echo $element->getValueHtml(); ?> </td> </tr> <?php endif; ?> <?php endif; ?> <?php endforeach; ?> </table></td> </tr></table></td></tr></table> </p></div> </td> <!-- CONTENT end --> </tr></table> </td> </tr></table>
September 3, 2018 at 9:37 am #26888Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
September 3, 2018 at 9:42 am #26889Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- This reply was modified 7 years ago by
Ally. Reason: Fix the code to show group label
September 3, 2018 at 9:47 am #26890Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
September 3, 2018 at 1:02 pm #26911gbretin-22
ParticipantDear Ally,
Thanks for your answers.. I get AN AJAX ERROR when i put this exact code in my “quform-custom-code.php” file :
<?php /* * Plugin Name: Quform Custom Code * Description: Custom code for Quform. * Version: 1.0 */ // Paste in your custom code below /* * QUFORM email custom MLS */ function my_custom_notification_content(PHPMailer $mailer, Quform_Notification $notification, Quform_Form $form) { ob_start(); include __DIR__ . '/email-content.php'; $mailer->Body = ob_get_clean(); } add_action('quform_pre_send_notification_4_1', 'my_custom_notification_content', 10, 3); add_action('quform_pre_send_notification_5_1', 'my_custom_notification_content', 10, 3); add_action('quform_pre_send_notification_6_1', 'my_custom_notification_content', 10, 3); add_action('quform_pre_send_notification_7_1', 'my_custom_notification_content', 10, 3); /* * QUFORM email autoreply CLIENT */ function my_custom_autoreply_content(PHPMailer $mailer, Quform_Notification $notification, Quform_Form $form) { ob_start(); include __DIR__ . '/autoreply-content.php'; $mailer->Body = ob_get_clean(); } add_action('quform_pre_send_notification_4_2', 'my_custom_autoreply_content', 10, 3); add_action('quform_pre_send_notification_5_2', 'my_custom_autoreply_content', 10, 3); add_action('quform_pre_send_notification_6_2', 'my_custom_autoreply_content', 10, 3); add_action('quform_pre_send_notification_7_2', 'my_custom_autoreply_content', 10, 3);
Please Help. Thank you by advance
September 3, 2018 at 1:06 pm #26912gbretin-22
ParticipantPS : I’ve enabled wp-debug and nothing appears in debug log…
thanks
September 3, 2018 at 1:23 pm #26913gbretin-22
ParticipantPS 2 : nothing appears in dev tools console too.
But it’s clear it’s coming from our “quform-custom-code.php” file because there was no error before (and our cookies are all cleared because we try on private session into chrome and firefox)…
Debug log empty, cookies cleared, no error in console mode….
I guess we need a pro…
THNAK YOU SO MUCH for your forthcoming reply
September 3, 2018 at 1:30 pm #26914gbretin-22
ParticipantLast info (just in case) : updated wordpress from 4.9.7 to 4.9.8… still the same issue…
September 3, 2018 at 1:35 pm #26915gbretin-22
ParticipantJust to be totally sure, we revert to old “quform-custom-code.php” file and everything works perfectly (without any AJAX ERROR)
old code =
<?php /* * Plugin Name: Quform Custom Code * Description: Custom code for Quform. * Version: 1.0 */ // Paste in your custom code below // QUFORM demande devis email custom pour MASTER LAB SYSTEMS //////////// add_action('quform_pre_send_notification_4_1', function (PHPMailer $mailer, Quform_Notification $notification, Quform_Form $form) { ob_start(); include __DIR__ . '/email-content.php'; $mailer->Body = ob_get_clean(); }, 10, 3); // QUFORM demande devis email autoreply custom pour CLIENT //////////// add_action('quform_pre_send_autoreply_4_2', function (PHPMailer $mailer, Quform_Notification $notification, Quform_Form $form) { ob_start(); include __DIR__ . '/autoreply-content.php'; $mailer->Body = ob_get_clean(); }, 10, 3);
Thank you very much for the forthcoming fix of this file.
- This reply was modified 7 years ago by
- AuthorPosts
- You must be logged in to reply to this topic.