It was probably only partially merged in when porting to D7, which means the user interface is there but it's totally ignored in the actual code.

Note: I'm currently creating a bunch of issues as a reminder for myself that I discovered while using the module.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dgtlmoon’s picture

yeah, now i remember this issue too, i think i was stripping it back so it would work better with token support for the title

jking1224’s picture

I'm very new to Drupal, long time programmer, but no experience with PHP, so I'm new to its syntax.
I'm looking at the code in file: simplenews_schedule.module
and it seems the code in function _simplenews_scheduler_new_edition() is where the problem lies.

I'm trying to fix this item, but my inexperience isn't helping. It sets the the newly created edition node's title here and I see the call to token_replace(), but as noted by the issue, the new title is same as the original title, no tokens replaced.

If someone can help me with the proper code and syntax, I can make the change on my machine and test it out. Perhaps the change needs to occur in a different function in this file? I'm jsut too unfamiliar with PHP, Drupal, variable scope, etc. to get this.

Also, if I change the code and upload the revised file to my website, do I have to do anything to get the new code to run? compile? flush caches? enable/re-enable the module?

jking1224’s picture

I figured out a code fix for this. I'm not sure its very efficient or the proper/best way to do this. But I post my code here in the hope it helps someone else out. I also don't know how to do the whole "commit" of code process.

file: simplenews_scheduler.module
function: _simplenews_scheduler_new_edition
code:
....(existing code)...
// Run the title through token replacement.
//$edition_node->title = token_replace($edition_node->title, array('node' => $edition_node));
// FIX: take title pattern from the scheduler, not newsletter node.
$schedrecord = db_select('simplenews_scheduler', 's')
->fields('s')
->condition('nid', $template_node->nid)
->execute()
->fetchAssoc();
$edition_node->title = token_replace($schedrecord['title'], array('node' => $template_node));
....(more code)...

joachim’s picture

Thanks for taking the time to work on this.

Could you post your changes as a patch please?

jking1224’s picture

As I said, I'm new to this whole Drupal, PHP thing. I have no idea how to post patches. I'm not using git as it seems every one is. I'm just using notepad to edit my code at this point. Is there some documentation somewhere on how to make patches and submit them?

joachim’s picture

jking1224’s picture

Code fix as a patch attached. Uses the scheduler record to get new edition title pattern, not the newsletter itself.

dgtlmoon’s picture

Extra points if your patch includes a mod to the simpletests test :D

jking1224’s picture

as I said, I'm new to all this. I don't know what you're referring to. Give me a clue?

dgtlmoon’s picture

Status: Active » Needs review
FileSize
2.69 KB

See supplied patch, I've rerolled your modification with a test included, you'll need to read up on the simpletest stuff, but nice fix!

dgtlmoon’s picture

Status: Needs review » Fixed

Comitted, including extra test

Status: Fixed » Closed (fixed)

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