• In plain text email, when using the {REFERENCELINKS} code, the numbers are appended to text which includes links but the table of links is not included at the bottom. The reason seems to be because {REFERENCELINKS} is removed prior to the check for its presence when adding the link table. See below for a patch on version 10.18.3 which seems to fix the issue.

    diff -Naur subscribe2.orig/classes/class-s2-core.php subscribe2/classes/class-s2-core.php
    --- subscribe2/classes/class-s2-core.php        2015-02-04 22:27:55.000000000 +0000
    +++ /var/sites/secblog/wp-content/plugins/subscribe2/classes/class-s2-core.php  2015-02-09 17:42:09.949548744 +0000
    @@ -497,7 +497,6 @@
                    $excerpttext = $plaintext;
    
                    if ( strstr($mailtext, "{REFERENCELINKS}") ) {
    -                       $mailtext = str_replace("{REFERENCELINKS}", '', $mailtext);
                            $plaintext_links = '';
                            $i = 0;
                            while ( preg_match('|<a([^>]*)>(.*)<\/a>|Ui', $plaintext, $matches) ) {
    @@ -514,6 +513,7 @@
                    $plaintext = trim(strip_tags($plaintext));
    
                    if ( strstr($mailtext, "{REFERENCELINKS}") && $plaintext_links != '' ) {
    +                       $mailtext = str_replace("{REFERENCELINKS}", '', $mailtext);
                            $plaintext .= "\r\n\r\n" . trim($plaintext_links);
                    }

    https://www.ads-software.com/plugins/subscribe2/

Viewing 6 replies - 1 through 6 (of 6 total)
  • @sjmurdoch,

    Thanks for spotting this, your fix looks reasonable however if there are no images in a particular post and therefore $plaintext_links is empty then I don’t think the {REFERENCELINKS} keyword will be removed.

    A better fix might be to replaced the latter if statement:
    if ( strstr($mailtext, "{REFERENCELINKS}") && $plaintext_links != '' ) {
    with:
    if ( isset( $plaintext_links ) && '' !== $plaintext_links ) {

    Does that work for you?

    Thread Starter sjmurdoch

    (@sjmurdoch)

    Good point. Here’s the patch I’m running with that seems to work (now on 10.18.4)

    --- class-s2-core.php	2015-02-10 00:44:36.000000000 +0000
    +++ class-s2-core.php	2015-02-11 17:25:00.828988178 +0000
    @@ -513,7 +513,7 @@
    
      		$plaintext = trim(strip_tags($plaintext));
    
    -		if ( strstr($mailtext, "{REFERENCELINKS}") && $plaintext_links != '' ) {
    +		if ( isset( $plaintext_links ) && '' !== $plaintext_links ) {
     			$plaintext .= "\r\n\r\n" . trim($plaintext_links);
     		}
    Thread Starter sjmurdoch

    (@sjmurdoch)

    Is this fix going to be rolled into the release? I noticed 10.18.5 came out but the problem still seems to be there.

    @sjmurdoch,

    This is patched in Subscribe2 HTML but I no longer have commit privileges to the free version. Maybe it’ll get picked up by the ReadyGraph folks at some point, perhaps email them direct:
    [email protected]

    Yes this patch will be rolled out in next release.

    @tanaylakhani

    Thanks for the update – will you also be addressing some of the bug fixes and enhancements in the trac as some point in the future?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[PATCH] REFERENCELINKS template parameter doesn't include links’ is closed to new replies.