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

  RSS

Salubritas
(@salubritas)
Active Member
Joined: 4 months ago
Posts: 11
06/07/2019 1:28 pm  

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.


Topic Tags
Astghik
(@astghik)
Support Team Admin
Joined: 2 years ago
Posts: 3456
08/07/2019 12:24 pm  

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
(@salubritas)
Active Member
Joined: 4 months ago
Posts: 11
08/07/2019 2:45 pm  

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
(@astghik)
Support Team Admin
Joined: 2 years ago
Posts: 3456
08/07/2019 3:15 pm  

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
(@salubritas)
Active Member
Joined: 4 months ago
Posts: 11
08/07/2019 3:45 pm  

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


Share:
Green
Default
Pear
Black Emo
{green}:grinning:
{green}:wink:
{green}:face:
{green}:inlove:
{green}:sweaty:
{green}:surprised:
{green}:lovekiss:
{green}:laugh:
{green}:formalsmile:
{green}:displeased:
{green}:cool:
{green}:resent:
{green}:nerd:
{green}:screaming:
{green}:amazed:
{green}:sad:
{green}:deceitful:
{green}:starryeyes:
{green}:evil:
{green}:shocked:
{green}:tears:
{green}:sulky:
{green}:smile:
{green}:vomited:
{green}:hi:
{green}:afraid:
{green}:crazy:
{green}:rabid:
{green}:fighting:
{green}:nonoise:
{green}:blushed:
{green}:idontknow:
{green}:scared:
{green}:razz:
{green}:kiss:
{green}:eat:
{green}:shutmouth:
{green}:gape:
{green}:suspicious:
{green}:laughingoutloud:
{green}:bruise:
{green}:crying:
{green}:pray:
{green}:serious:
{green}:excitement:
:)
:d
:wink:
:mrgreen:
:neutral:
:twisted:
:arrow:
:shock:
:???:
:cool:
:evil:
:oops:
:razz:
:roll:
:cry:
:eek:
:lol:
:mad:
:sad:
:!:
:?:
:idea:
:hmm:
:beg:
:whew:
:chuckle:
:silly:
:envy:
:shutmouth:
{pear}:happy:
{pear}:smile:
{pear}:laugh:
{pear}:laughingoutloud:
{pear}:crying:
{pear}:exhausted:
{pear}:nerd:
{pear}:surprised:
{pear}:veryhungry:
{pear}:wink:
{blackemo}:laughtertotears:
{blackemo}:gift:
{blackemo}:love:
{blackemo}:inlove:
{blackemo}:shamefaced:
{blackemo}:heart:
{blackemo}:crazy:
{blackemo}:anguished:
{blackemo}:bruise:
{blackemo}:easymoney:
{blackemo}:exhausted:
{blackemo}:vampire:
{blackemo}:shutmouth:
{blackemo}:wink:
{blackemo}:carnival:
{blackemo}:flowers:
{blackemo}:hotdrink:
{blackemo}:party: