Notifications
Clear all

[Closed] Comment approved email template does not add p tags

5 Posts
2 Users
0 Reactions
2,285 Views
(@salubritas)
Active Member
Joined: 5 years ago
Posts: 15
Topic starter  

I have set up the email message templates under Phrases / Email.

Most of these are working correctly, except for the “Comment approved message”.

The other messages insert p tags to create line breaks, in the same way as a standard WordPress post. But the Comment approved message is not inserting p tags when an email is generated from it, so the email content is all run together.

Here is the template for the comment approved message:

Here is the test comment just before it is posted:

After approving the comment, the following email is received:

As you can see, there are no paragraph breaks in the email at all.

This is not a problem with the various comment notification emails, just the comment approved email.


   
Astghik
(@astgh)
Illustrious Member Admin
Joined: 7 years ago
Posts: 6147
 

Hi @salubritas,

Thank you for contacting us and for giving so detailed information. 

We've checked and don't find such an issue on all our test websites. This is something specific on your website. 

Could you please install and activate the Duplicator — WordPress Migration Plugin, backup your WordPress site and send it to info[at]gvectors.com email address to allow us to check it?


   
(@salubritas)
Active Member
Joined: 5 years ago
Posts: 15
Topic starter  

Before I do that, here are some additional findings.

I ran the following query against the database:

SELECT * FROM webretailernew.wp_wc_phrases
where phrase_key IN ('wc_email_message','wc_all_comment_new_reply_message',
'wc_new_reply_email_message','wc_comment_approved_email_message');

This brings back all four messages that I set up.

The results show that the new comment notification messages are all stored with <p> tags in the database, but the comment approved message has no <p> tags in the database.

Looking at the code in class.WpdiscuzOptions.php, function phrasesOptionsForm, the calls to set all the new comment notification messages are wrapped in wpautop, but the call to set the comment approved message is not. (It isn't wrapped with esc_attr either.)

vs

I am a developer, although not in WordPress or PHP, but it seems pretty clear that this accounts for the message not having <p> tags in the database, and that in turn explains why there are no paragraph breaks in the email message itself.

 


   
Astghik
(@astgh)
Illustrious Member Admin
Joined: 7 years ago
Posts: 6147
 

Thank you @salubritas for letting us know. 

The duplication of the website is not necessary anymore. 

Posted by: @salubritas

Looking at the code in class.WpdiscuzOptions.php, function phrasesOptionsForm, the calls to set all the new comment notification messages are wrapped in wpautop, but the call to set the comment approved message is not. (It isn't wrapped with esc_attr either.)

yes, the issue comes from that part. Please add manually the esc_attr and it'll work fine. 

We'll also change this in the next version release. 

 


   
(@salubritas)
Active Member
Joined: 5 years ago
Posts: 15
Topic starter  

OK, thanks. I've manually changed the code (it needed wpautop not esc_attr) and tested and it is now working as expected.


   
Share:
Scroll to top