Minor bug in email-ad-enabled-user.tpl.php
-
Hello AWP Classifieds Team,
I found two small bugs and a translation issue in the email that is sent to the ad owner when an admin approves a listing. Both are in the template:
frontend/templates/email-ad-enabled-user.tpl.phpEnvironment: AWP Classifieds 4.4.7, WordPress (PHP 8.x), site language German (de_DE). Emails are sent as plain text.
Bug 1 —
"shown literally instead of real quotation marksThe body line renders as:
Your Ad "Testanzeige" was recently approved by
Root cause (line 15): the string is wrapped in
esc_html__(). Because the email is plain text,esc_html()converts the literal double quotes in the sentence into the HTML entity", which is then shown verbatim in the plain-text mail. The same applies toesc_html( $listing_title )andesc_html( $contact_name )— any character thatesc_html()encodes will appear as an HTML entity in the plain-text email.Suggested fix: do not run
esc_html()on content that goes into a plain-text email (use the raw translated string /$listing_titledirectly, or decode entities). This affects all languages, not only German.Bug 2 — blog name and site URL run together (missing line break)
The footer renders as:
Dackel.dehttps://http://www.dackel.de
Root cause (lines 21–23): the blog name is echoed in one
<?php ... ?>block and the URL in the next. PHP strips the single newline immediately following?>, so there is no line break between the two values.Suggested fix: emit an explicit newline, e.g.
echo awpcp_get_blog_name() . "\n";before echoinghome_url().Minor note (localization): In the bundled
languages/another-wordpress-classifieds-plugin-de_DE.po, the body string “Your Ad “%1$s” was recently approved by the admin…” has an emptymsgstr, so it falls back to English even on German sites. (The greeting “Hello %s,” is translated.) Adding the German translation would complete the localization.Thanks for a great plugin!
Best regards,
Christian Ludger
You must be logged in to reply to this topic.