Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#10 | 1461200-ensure-custom-title-and-test.patch | 2.69 KB | dgtlmoon |
#7 | 1461200-7-title-new-editions.patch | 1.01 KB | jking1224 |
Comments
Comment #1
dgtlmoon CreditAttribution: dgtlmoon commentedyeah, now i remember this issue too, i think i was stripping it back so it would work better with token support for the title
Comment #2
jking1224 CreditAttribution: jking1224 commentedI'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?
Comment #3
jking1224 CreditAttribution: jking1224 commentedI 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)...
Comment #4
joachim CreditAttribution: joachim commentedThanks for taking the time to work on this.
Could you post your changes as a patch please?
Comment #5
jking1224 CreditAttribution: jking1224 commentedAs 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?
Comment #6
joachim CreditAttribution: joachim commentedhttp://drupal.org/patch
Comment #7
jking1224 CreditAttribution: jking1224 commentedCode fix as a patch attached. Uses the scheduler record to get new edition title pattern, not the newsletter itself.
Comment #8
dgtlmoon CreditAttribution: dgtlmoon commentedExtra points if your patch includes a mod to the simpletests test :D
Comment #9
jking1224 CreditAttribution: jking1224 commentedas I said, I'm new to all this. I don't know what you're referring to. Give me a clue?
Comment #10
dgtlmoon CreditAttribution: dgtlmoon commentedSee supplied patch, I've rerolled your modification with a test included, you'll need to read up on the simpletest stuff, but nice fix!
Comment #11
dgtlmoon CreditAttribution: dgtlmoon commentedComitted, including extra test