WordPress Subscribe2 plugin escapes characters in blog name when sending email
I am using the Subscribe2 plugin on my new upcoming WordPress blog ( http://www.adlerr.com ). The title of my blog is "Rob Adler's Blog". When sending an email, Subscribe2 escapes the apostrophe in my blog title and the email subject is received like this:
[Roee Adler's Blog] Please confirm your request
Email body:
Roee Adler's Blog has received a request to
subscribe for this email address. To complete your
request please click on the link below:
...
I would naturally like to have a "normal" version of my blog's name running out in the title and body.
I asked this doctype.com question with no success ( here's the question ), however from the answers I figured out, this probably requires changes in the plugin PHP code, so I would rather ask it here.
Following the answers I received on the doctype, I changed the following section of code:
function substitute($string = '') {
if ('' == $string) {
return;
}
$string = htmlspecialchars_decode(str_replace("BLOGNAME", get_option('blogname'), $string));
$string = str_replace("BLOGLINK", get_bloginfo('url'), $string);
$string = htmlspecialchars_decode(str_replace("TITLE", stripslashes($this->post_title), $string));
$string = str_replace("PERMALINK", $this->permalink, $string);
In the above code, I added a wrapper htmlspecialchars_decode
to generate both BLOGNAME and TITLE, however the subject and email body still contain '
.
What can I do to fix this problem?
thank
source to share
According to the documentation on,htmlspecialchars_decode
you need to pass it ENT_QUOTES
as an argument $quote_style
to convert it '
to '
. Try to install ENT_QUOTES
:
function substitute($string = '') {
if ('' == $string) {
return;
}
$string = htmlspecialchars_decode(str_replace("BLOGNAME", get_option('blogname'), $string), ENT_QUOTES);
$string = str_replace("BLOGLINK", get_bloginfo('url'), $string);
$string = htmlspecialchars_decode(str_replace("TITLE", stripslashes($this->post_title), $string), ENT_QUOTES);
$string = str_replace("PERMALINK", $this->permalink, $string);
source to share
WordPress replaces the apostrophe in the blog title '
before it stores it in the database. If you want to override this, edit your functions.php file and insert the following statement:
update_option("blogname", "My Blog Title With Apostrophe");
This will force the title to be exactly what you enter. Changes to the blog title you make in the Settings menu will have no effect.
source to share