WordPress.org

Ready to get started?Download WordPress

Forums

Subscribe2
Text digest in 7.2 lacks newlines (8 posts)

  1. belg4mit
    Member
    Posted 2 years ago #

    The upgrade to 7.2 has broken plain text digests (in excerpt mode).

    All of the excerpts run together as one block of text.

    http://wordpress.org/extend/plugins/subscribe2/

  2. mattyrob
    Member
    Plugin Contributor

    Posted 2 years ago #

    @belg4mit,

    I cannot reproduce, digests with multiple posts look fine in my email clients.

    Between 7.1 and 7.2 there were 2 lines of code added to the digest code (the subscribe2_cron() function):

    $message_post = preg_replace('|\s+|', ' ', $message_post);
    $message_posttime = preg_replace('|\s+|', ' ', $message_posttime);

    These should just strip out multiple spaces and replaces them with a single space. Try commenting out those 2 lines and see if that fixes thing on your site.

  3. belg4mit
    Member
    Posted 2 years ago #

    Sorry, I meant 7.0.1, but those lines are the problem.
    \s matches newlines, as well as spaces, tabs, etc.

    Generally you would want something like:

    #collapse repeating whitespace characters
    $message_post = preg_replace('|(\s)+|', '\1', $message_post);

    or maybe the following, which is not UTF8 aware:

    #Replace multiple tabs and spaces with spaces
    $message_post = preg_replace('[\t ]+', ' ', $message_post);

    Unfortunately, the preview function in the settings panel is not as useful as it could be, especially for debugging, since numberposts=1

    Commenting out the "// remove excess white space from with $excerpt and $plaintext" lines gives the following, which is possibly a bit better, it's hard to tell.

    Below is a summary of the recent posts to the SfS website, in case you missed
    them.
    
    Google Science Fair Posted on: 2012-01-13 @ 10:31 AM
    http://example.com/cool-stuff/google-science-fair Students 1318,
    with parent permission, may enter to win up to $50,000 in the Google Science
    Fair. http://www.youtube.com/watch?v=LWiuUC9RDhY Guidelines for entering. The
    Sliver of Perception Posted on: 2012-01-10 @ 9:43 AM
    http://example.com/cool-stuff/the-sliver-of-perception original by
    abstruse goose (#421) At the feet of "The Alchemist" Posted on: 2011-12-13 @
    6:26 PM http://example.com/cool-stuff/the-alchemist Thank you so
    much once again, this was the teachers' and students' favorite field trip!!!
    Some of the 6th grade students from Everett's Parlin Elementary School on a
    field trip to MIT this morning. Students visited the MIT museum, built robots,
    toured campus and heard about the importance of doing well in school to keep
    their [...] YouTube for Schools Posted on: 2011-12-13 @ 5:32 PM
    http://example.com/cool-stuff/youtube-for-schools Last week Google
    launched YouTube for Schools, a system that allows network administrators of
    schools to give access to approved educational content on classroom computers
    without the distraction of silly cat videos :-D
    http://www.youtube.com/watch?v=NegRGfGYOwQ Learn more.

    instead of what unamended 7.2 sends

    Below is a summary of the recent posts to the SfS website, in case you missed
    them.
    
    Field Trips Posted on: 2012-02-07 @ 3:12 PM
    http://example.com/admin/field-trips UPDATE: We have ~20088 passes
    for the Museum of Science that expire 2/29, and we'd like to use them soon. We
    also have 100 IMAX passes usable for shows such as Ring of Fire, Tornado Alley,
    and Amazing Journeys; a 200-student field trip is quite an undertaking, and
    these will likely need to be shared [...] Preparation Posted on: 2012-02-03 @
    2:56 PM http://example.com/teach/preparation UPDATE: Add slide
    conversion and teaching calendar reminders, plus hyperlinks to checklist. Some
    staff asked about efficient ways to prepare for lessons, so we've gathered a few
    ideas below from Brad, Andrew and Jerrad. Choosing a module can be an involved
    process, but this may be simplified if you are first familiar with what is
    available [...] Meta: Module Sequences Posted on: 2012-02-03 @ 11:25 AM
    http://example.com/modules/sequences List below are a few short
    series of modules that can help reinforce one another: Chemistry
    C03Polymers/C08Chromatography  C14Viscosity C04Separation of Substances
    C08Chromatography C06Acids & Bases  C09Soap Earth Science
    ES03Projections/ES04Symbology  ES05Topography Life Science LS09Cell City  LS04C.
    elegans/LS14Mitosis/LS16DNA Extraction Physics P05Pendulums  P04Gravity P13Intro
    to Light  (P10Sound)  P03Blue Skies & Rainbows; Sliver of Perception Scientific
    Method SM07Observations  SM08Classification Suggest others in the [...]
    (Electro-)Magnetism Posted on: 2012-02-03 @ 12:00 AM
    http://example.com/modules/physics/p09 Introduces a variety of
    magnetic phenomenon including but not limited to ferromagnetism. Students should
    have some familiar with electricity/electrons. original by abstruse goose (#281)
    Yankee Frugality Posted on: 2012-02-02 @ 6:57 PM
    http://example.com/cool-stuff/puzzles/yankee-frugality Yankees are
    well known for being frugal, living by the proverb "waste not, want not."
    Knowing that he can melt 11 used candle stubs into a new candle, an enterprising
    Yankee has collected 121 stubs. How many candles can he make?

    but still not as legible as what it used to be,
    which actually needed more newlines between excerpts

    Below is a summary of the recent posts to the SfS website, in case you missed
    them.
    
    Riddles new & old
    Posted on: 2012-01-24 @ 10:00 PM
    http://example.com/cool-stuff/puzzles/riddles-new-old
    
    I have many forks but never eat, yet I breathe and drink deeply. What am I?
    
    You are stuck in a room without any openings, just a table and a mirror. How do
    you get out?
    
    Save that stuff
    Posted on: 2012-01-19 @ 2:23 PM
    http://example.com/admin/save-that-stuff
    
    These are things we could use in some of our lessons:
    
    Uncrushed aluminum cans, especially small ones like Red Bull, and Trader Joe's
    Latte.
    Portable disc playersà la Discmanthey need not be fully functional, just
    spin-up normally
    Empty Altoids tins.
    Leftover vermiculite packaging from lab supplies or used disposable hand
    warmers. There are a number of things we can [...]
    
    Contracts & Remuneration
    Posted on: 2012-01-18 @ 11:50 AM
    http://example.com/admin/remuneration
    
    UPDATE: Add spring schools and update receipt directions on invoice template.
    
    Government forms:
    
    	I-9 — Employment elligibility
    	W-4 — Tax withholdings
            Optional pre-tax health insurance withholding under Section 125
    
    Science from Scientists Contracts:
    
    	Instructor Contract & Handbook
    	Non-Disclosure Agreement
    
    Also for your you edification, the School's Memorandum of Understanding.
    
    Internal forms (Be sure to read the [...]
    
    Field Trips
    Posted on: 2012-01-18 @ 11:00 AM
    http://example.com/admin/field-trips
    
    UPDATE: We have ~200 passes for the Museum of Science that expire 2/29, and we'd
    like to use these ASAP. We also have 100 IMAX passes usable for shows such as
    Ring of Fire, Tornado Alley, and Amazing Journeys.
    
    This is the perfect season for field trips. We currently offer field trips to
    MIT and the [...]
  4. belg4mit
    Member
    Posted 2 years ago #

    The offending line for me (plain text digest) is #3859

    $message_posttime = preg_replace('|\s+|', ' ', $message_posttime);

    Which has the same regex issue as stated above, although those particular lines you pointed to appear to apply to some other branch of the code since $message_posttime is compost independently.

    P.S. Tripling up the EOLs on line 3851 (and 3850 probably) improves digest legibility. Note that the first one is used to terminate the excerpt, and the second to give a blank line. But some excerpts may have blank lines in them themselves (due to paragraphs before and after videos, etc.). The 3rd NL results in a pair of NL between excerpts, making them easier to distinguish.

  5. mattyrob
    Member
    Plugin Contributor

    Posted 2 years ago #

    @belg4mit,

    Strange that the regex works fine on my sites but we obviously need a more robust regex for different sites. I'll work on that for the next release.

  6. raybman
    Member
    Posted 2 years ago #

    I'm having the same problem as the first OP.

    My Digest email is missing the line breaks between the different posts listed, so all is running into the other.

    Using Subsribe2 Version 7.2, all was fine until this last update.

    @MattyRob
    Went ahead and used the blocking method and it seemed to do the trick for me.
    Thanks

  7. mattyrob
    Member
    Plugin Contributor

    Posted 2 years ago #

    @raybman,

    The missing line breaks will be fixed in the next version. For the time being comment out the lines discussed above.

  8. Ripplestone
    Member
    Posted 2 years ago #

    I'd just like to share that I have run into the same issue, and came to the same conclusion. Here is my form post about it:
    wordpress.org/support/topic/subscribe2-emails-have-no-line-breaks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags