Greg Marshall
Forum Replies Created
-
Hi sorry to jump in on this, I also have this issue and it appears to only happen when WordFence sends an email from the site.
Just curious if OP also has wordfence installed?
Email subject is ususally “[Wordfence Alert] Problems found on domain.com”
Hello, Sorry again for my late reply. I have modified the code you gave me and appear to have quite a good working solution. I thought I would share it in case someone else finds it handy. It’s also commented so should be easily adapted if need be. I have also credited you guys in my comments for the initial help
Please see link to the Gist I made:
https://gist.github.com/AWOL-TECH/f6a413754a0e2e62393193b33dd4eb78Hi there,
Yeah I couldn’t find anything that looked relevant in the docs unfortunately. Please do let me know if a method is figured out
Thanks
Hi sorry for the delay, I have implemented the code and I’m currently testing / monitoring for issues. So far seems to be working perfectly though. Big thank you for the assist
Thanks for the help,
I had to change it every so slightly to make it work but it does appear to be working
if ($logger->slug !== 'SimplePostLogger') { return $doLog; } // Bail if not correct message. if ($context['_message_key'] !== 'post_deleted') { return $doLog; }thanks
Forum: Plugins
In reply to: [Advanced Custom Fields: Font Awesome Field] Possible missing icons?Ah thanks for the quick reply, I was literally coming back here to say that I didnt have Solid pack enabled. I didn’t realise ‘regular’ did not include all the basic icons, so yep, I needed to enable the solid pack! Appears to be one of those days haha
Thanks 🙂
Thanks Patrick,
I have just left a 5 star review for you there.
Thanks again 🙂
Hello,
I never thought to actually just hook into the WP_Mail function and strip the tags that way, good idea and it appears to be working well.
Thank you very much for this!
However I would still recommend developing a Plain text email feature (check box) for the email editor (with all HTML tags natively stripped).
Thanks again. I’ll be sure to recommend the plugin to others. Great support
Thank you for letting me know, I was wondering if my additional question had been missed!
I have used the code below to replace the ordered list output with an easy table layout for our regular email notifications. This worked very well, however for the text messages (SMS) side I have found that I still cannot strip the html tags, the <p> tag always seems to come back. For my Text message forms, they usually only send 1 field out of the 3 fields on the form so not sure if that makes a difference. I have commented out the stuff for the text messages as it doesnt work, the rest of the code is currently in use and is outputting the email data as intended (the extra html tags don’t matter there).
add_filter( 'forminator_get_formatted_form_entry', 'forminator_modify_email_format', 20, 5 ); function forminator_modify_email_format( $html, $custom_form, $data, $entry, $ignored_field_types ){ $ignored_field_types = Forminator_Form_Entry_Model::ignored_fields(); $form_fields = $custom_form->get_fields(); $table_rows = array(); if ( is_null( $form_fields ) ) { $form_fields = array(); } foreach ( $form_fields as $form_field ) { $field_type = $form_field->__get( 'type' ); if ( in_array( $field_type, $ignored_field_types, true ) ) { continue; } $label = $form_field->get_label_for_entry(); $value = render_entry( $entry, $form_field->slug ); $table_rows[ $label ] = $value; } $thecustomformarray = get_object_vars($custom_form); $thecustomform = $thecustomformarray['notifications']['0']; /*error_log('$thecustomform: ' . print_r($thecustomform, 1)); if ($thecustomform['label'] === 'Customer Email to Text Message' || strpos( $thecustomform['email-subject'], "123456") !== false || in_array("123456", $thecustomform) ) { // was unable to strip tags from the text/SMS from here error_log('Customer TEXT FOUND HTML'); $thecustomform['email-editor'] = wp_strip_all_tags($thecustomform['email-editor']); $html = wp_strip_all_tags($html); }*/ if ($thecustomform['label'] === 'Customer Email' || $thecustomform['email-subject'] === 'NEW MESSAGE'){ // error_log('Customer Email FOUND HTML'); $html = '<table>'; foreach ($table_rows as $table_label => $table_value){ $html .= "<tr>"; $html .= "<th style='text-align:left; vertical-align: top;'>" . $table_label ."</th>"; $html .= "<td>" . $table_value ."</td>"; $html .= "</tr>"; } $html .= '</table>'; } /* USE THIS FOR TEXT MESSAGING WHEN ITS FIGURED OUT $html = ''; foreach ($table_rows as $line_label => $line_value){ $html .= $line_label . ": " . $line_value . "\r\n"; //} */ return $html; }so if you guys can assist me in getting the html tags removed from the text messages that would be fantastic and followed by a big thank you. As you can see in the code I am mainly checking the email subject or the label of the email action in order to determine if its an email or an SMS/text. All text/SMS messages must have the pincode in the subject line, I swapped it out with 123456 here
- This reply was modified 3 years, 5 months ago by Greg Marshall.
Hello, I had a further question regarding the above snippet.
as mentioned n my last reply it is working as expected, however I have noticed another issue I have not experienced before. Some of our forms will not be using the “dynamic signatures” these forms send their email message to a Email to Text (SMS) service. The problem I now face is that the text message service will notp support HTML tags and the body content of all emails is auto wrapped in <p> tags. which means the text message literally shows on a phone as <p>message content</p>.
I attempted to add this to the above code but it doesn’t seem to work fully
$thecustomformarray = get_object_vars($custom_form); $thecustomform = $thecustomformarray['notifications']['0']; if (in_array("Customer Email to Text Message", $thecustomform)) { $message = wp_strip_all_tags( $message ); error_log('Customer Email to Text Message FOUND');I do get the error log statement but the text message is still sent wrapped in the <p> tags.
Could someone please advise. I also copied the snippet from Adam’s reply in this thread direct but it didn’t work either.
https://wordpress.org/support/topic/plain-text-emails-3/
Anyway would appreciate if someone can let me know a suitable way to do this please. OR better yet, a “Plain Text” checkbox in the email notification settings so that content is not auto wrapped in html tags 😀
EDIT: this appears to be happening by the email body editor in the add email notification screen. Switching from visual to text reinserts the p tags even if you remove them. They are also added again on save.
- This reply was modified 3 years, 5 months ago by Greg Marshall. Reason: added info
Hello,
Thanks for this Ive now gotten my custom signatures working. The key piece I was missing was:
( $message, $custom_form, $data, $entry, $cls ) {Everything appears to be working however I am still to thoroughly test but initial results look good.
Would definitely recommend adding this kind of stuff to your documentation
thanks for the help 🙂
Hello,
thanks for the quick response, I look forward to hearing back from you.
As an example (as many people like to know that you’ve tried yourself before they give help) I did attempt to modify the notifications sub array but that doesn’t seem to be the content sent via email.
foreach ( $custom_form->notifications as $key => $value ) { $value['email-editor'] .= "<p>ADDED FOR TESTING</p>";Thanks
- This reply was modified 3 years, 5 months ago by Greg Marshall.
Here’s more
Time: 0 State: Sending data Info: SELECT <code>key</code>, <code>value</code> FROM <code>wp_nf3_action_meta</code> WHERE <code>parent_id</code> = 457 Progress: 0.000Command: Query Time: 0 State: Sending data Info: SELECT <code>key</code>, <code>value</code> FROM <code>wp_nf3_form_meta</code> WHERE <code>parent_id</code> = 228 Progress: 0.000Command: Query Time: 0 State: Sending data Info: SELECT <code>key</code>, <code>value</code> FROM <code>wp_nf3_action_meta</code> WHERE <code>parent_id</code> = 2106 Progress: 0.000Command: Query Time: 0 State: Sending data Info: SELECT <code>key</code>, <code>value</code> FROM <code>wp_nf3_form_meta</code> WHERE <code>parent_id</code> = 663 Progress: 0.000Command: Query Time: 0 State: Sending data Info: SELECT <code>key</code>, <code>value</code> FROM <code>wp_nf3_form_meta</code> WHERE <code>parent_id</code> = 21 Progress: 0.000Command: Query Time: 0 State: Sending data Info: SELECT <code>key</code>, <code>value</code> FROM <code>wp_nf3_form_meta</code> WHERE <code>parent_id</code> = 463 Progress: 0.000non forms pages in the dashbaord also have loads of these queries which is also adding extra load
Command: Query Time: 0 State: Sending data Info: SELECT <code>key</code>, <code>value</code> FROM <code>wp_nf3_form_meta</code> WHERE <code>parent_id</code> = 140 Progress: 0.000Command: Query Time: 0 State: Sending data Info: SELECT <code>key</code>, <code>value</code> FROM <code>wp_nf3_form_meta</code> WHERE <code>parent_id</code> = 448- This reply was modified 4 years, 5 months ago by Greg Marshall.
Forum: Plugins
In reply to: [WP Activity Log] PHP WarningAlso having this issue
PHP Warning: Use of undefined constant php – assumed ‘php’ (this will throw an Error in a future version of PHP) in /public_html/wp-content/plugins/wp-security-audit-log/classes/Views/Settings.php on line 968
Hello,
That sounds good, I am happy to manually integrate so long as it works 🙂