Simplenews 6.x-2.x-dev from Feb 2
MimeMail 6.x-1.0-alpha7

Hi folks, probably something I'm missing somewhere, I'm just trying Simplenews out for the first time, apologies: Anyway, I set my 'Default newsletter options: Format' to html under 'Simplenews Settings'. I then create a new Newsletter under 'Content management > Newsletters management' and give it a name, leave all the defaults as is, and save.

Then I Create a new content 'Newsletter Issue' and choose my newly added Newsletter from the dropdown, add title, body and Save. Then I go to the Newsletter tab to send it, but under 'Email options' the 'Email format' is set to 'plain'..... Am I missing some other setting somewhere? I just thought if I set the master default to html then new newsletters would inherit that?

Apologies if I'm missing a concept or something simple. :)

JB

Comments

J.B-2’s picture

Component: Usability » Code
Category: support » bug

I think this is a bug, changing category to suit...

J.B-2’s picture

I've got a fix, which for me is at line 670 of the simplenews.module file, within the simplenews_nodeapi hook at the 'case insert' $op switch: replace the second
if (!isset($node->simplenews))
with
if (empty($node->simplenews))

...works for me.

simon georges’s picture

Status: Active » Fixed

Committed to CVS: http://drupal.org/cvs?commit=498858.

Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

ambient.impact’s picture

Is it possible that this bug (or a similar one) has made its way into 6.x-2.0-alpha2? I have the same problem as the original poster, but it appears to happen semi-randomly, and even occurs on newsletters I've already test-sent as HTML, which one assumes would have the setting saved.

loophole080’s picture

@ambient - maybe this: http://drupal.org/node/1132404 ?

ambient.impact’s picture

Thanks, but I had this problem before upgrading to Mime Mail 6.x-1.0-beta1, so it doesn't seem to be affected by that. Actually sending HTML properly doesn't seem affected, either before upgrading both modules, and after.

megachriz’s picture

Title: Default Format (html) not applied in new newsletter » Default Format (html) not applied in updated newsletter, advanced settings get cleared after updating node
Version: 6.x-2.x-dev » 6.x-2.0-alpha2
Status: Closed (fixed) » Needs work

In 6.x-2.0-alpha2 the advanced settings are cleared when updating the node. 's_format' will get empty in the table 'simplenews_newsletters'.

When inserting a node, $node->simplenews is this:

[simplenews] => Array
(
    [advanced] => Array
        (
            [s_format] => html
            [priority] => 0
            [receipt] => 0
        )

    [s_status] => 0
    [test_address] => test@example.com
)

When updating a node, $node->simplenews is this:

[simplenews] => Array
(
    [nid] => 53
    [vid] => 54
    [tid] => 7
    [s_status] => 0
    [s_format] => html
    [priority] => 0
    [receipt] => 0
    [sent_subscriber_count] => 0
)

The function simplenews_newsletter_update() expects the advanced settings to be in the 'advanced'-array, but this array doesn't exists when the node gets updated, resulting in an empty 's_format' value.

jsobiecki’s picture

Status: Needs work » Needs review
StatusFileSize
new1.74 KB

Hi,

I have prepared a patch, which should hopefully fix this issue. It basically reformats flat array to array with "advanced" sub array. Please review :)

miro_dietiker’s picture

serg.remote’s picture

Patch #9 works for me

OliverColeman’s picture

#9 works for me, too. Thanks harijari.

simon georges’s picture

Version: 6.x-2.0-alpha2 » 6.x-2.x-dev
Assigned: Unassigned » simon georges

Ok, it seems good. Before I commit it, shouldn't we call that on the node_load too, to have the same structure everywhere ?

jsobiecki’s picture

If we change structure of simplenews array at node load, there will be more more changes required.

In fact, every place, where code access simplenews[one of advanced properties] value, will be broken.

miro_dietiker’s picture

Currently the system has a flattening function for exactly this case.
While for D7 i expect we should reimplement this completely, i strongly vote for an absolute minimum solution. Changing more will possibly break everything that is based on simplenews and does extend the module.

Tests needed...
Someone around to write tests about this topic?

simon georges’s picture

Status: Needs review » Fixed

Patch in #9 committed on 6.x-2.x-dev for now. We really need to work on a test suite.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Thomassen’s picture

This fix did not work for me: Still, the plain format is always selected.

lavamind’s picture

Make sure to use the latest development version (6.x-2.x-dev).

Unfortunately it's still broken in the latest stable version (6.x-2.0-alpha2).