WordPress Subscribe2 plugin escapes characters in blog name when sending email

I’m using Subscribe2 plugin in my new upcoming WordPress blog (http://www.adlerr.com). My blog’s title is “Roee Adler’s Blog”. When sending an email, Subscribe2 escapes the apostrophe in my blog’s title, and the e-mail subject is received as follows:

[Roee Adler's Blog] Please confirm your request

The e-mail body is:

Read More
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 the “normal” un-escaped version of my blog name in the title and body.

I asked this question on doctype.com with no success (here’s the question), however from the answers I understood this probably requires changes to the PHP code of the plugin, so I would rather ask it here.

Following the answers I received on doctype, I did alter 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 code above, I added a htmlspecialchars_decode wrapper for the generation of both BLOGNAME and TITLE, however the e-mail subject and body still contains '.

What can I do to resolve this?

Thanks

Related posts

Leave a Reply

2 comments

  1. As per the documentation on htmlspecialchars_decode, you need to pass ENT_QUOTES as the $quote_style argument for it to convert ' to '. Try setting 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);
    
  2. WordPress replaces an apostrophe in the blog title with ' before it stores it in the database. If you want to override this, edit the functions.php file and insert the following statement:

    update_option("blogname", "My Blog's Title With Apostrophe");
    

    That 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.