Would it be hard to include an option to select multiple newsletters when creating a new newsletter issue?
I believe this would come very handy.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | simplenews 5-x.txt | 105.29 KB | lilott8 |
| #10 | simplenews.txt | 89.29 KB | tormu |
| #4 | multi-newsletter-support.patch | 7.43 KB | wmostrey |
Comments
Comment #1
sutharsan commentedJust set 'Multiple select' in the newsletter vocabulary.
Comment #2
wmostrey commentedYou are correct, many thanks!
Comment #3
wmostrey commentedI'm afraid it doesn't work. Only one tid is stored in the simplenews_newsletters and in the simplenews_submit function the array_intersect does not take into account multi-dimensional arrays. Two solutions for this:
1/
Why store the tid in the simplenews_newsletters db? With taxonomy_node_get_terms you can get the terms from the nid, which is already stored.
2/
Perhaps this check isn't even needed since you could use
<? taxonomy_node_get_terms_by_vocabulary($nid->nid, _simplenews_get_vid()); ?>
I am now implementing these changes (and then some) and will port the patches back.
Comment #4
wmostrey commentedHere you go. The simplenews.module misses the ?> at the end of the file btw, this is also fixed in this patch.
Comment #5
wmostrey commentedOfcourse, vocabulary_node_get_terms() and vocabulary_node_get_terms_by_vocabulary() only works after the node has been created (by selecting "Don't send now").
One error in the patch, change
$result = db_query(db_rewrite_sql('SELECT n.nid n.created FROM {node} n INNER JOIN {simplenews_newsletters} s ON n.nid = s.nid WHERE s.s_status = %d ORDER BY n.created ASC'), 1);
into
$result = db_query(db_rewrite_sql('SELECT n.nid, n.created FROM {node} n INNER JOIN {simplenews_newsletters} s ON n.nid = s.nid WHERE s.s_status = %d ORDER BY n.created ASC'), 1);
Comment #6
sutharsan commentedCould you please explain why it is handy to have multiple terms related to one newsletter.
Note that the closing php code tag is not used. See http://drupal.org/node/545
Comment #7
wmostrey commentedDon't see it as multiple terms, see it as sending one newsletter issue to multiple newsletters. For instance if you have a newsletter 'Belgium' and one 'Netherlands', with this patch you can send a newsletter issue two both of them, instead of having to create two nodes for it.
Comment #8
wmostrey commentedComment #9
tormu commentedOk, since this is not contributed to the module already though patch has been made, I don't think it should be closed..
I just found this post after making an issue of it myself, http://drupal.org/node/161414
I'll have to try implementing that patch in this thread myself too.
Comment #10
tormu commentedChanged the version back to 1.1, since the original patch was made for it. I really hope this get implemented to the newest version of Simplenews, though I think the stable 1.1 and the newest version are quite different from each other. The patch introduced was and is really buggy: after correcting the query like suggested on the comment it still didn't send the mails. It ended up giving 6 errors about array being sent instead of ID number, which was due to "$term = taxonomy_get_term($tid);" at the _simplenews_send(). I made some changes only to that function in order to get the patch working.
There are still things that should be addressed even if you get this implemented:
I attached my current simplenews.module (as .txt cos of file type limitations), which is the 1.1 version downloaded today + patch by wmostrey + my changes to make the patch actually work.
Comment #11
dgtlmoon commentedThere is also the simplenews scheduler newsletter module, you could create a newsletter that loads the body of other newsletters?
Comment #12
1st-angel commentedIs this possible in the current version?
Comment #13
sutharsan commentedNo, it is not possible with simplenews 6.x. Feel free to submit code for it.
Comment #14
sutharsan commentedThis conflicts with the design of simplenews. It needs a major rewrite to make it happen.
Comment #15
lilott8 commentedI have a working solution. I want other people to test this before I turn it live on my website. I will draw up the documents and make it easy to implement :) The working solution is for 5.x version only. You can take a gander on my current modified module, as I will attach it; this builds on the patch that was attached in this thread. Happy sending!
Comment #16
Jackinloadup commented@lilott8 Thanks for posting your solution in both possible relevant threads.
Maybe we should rename the threads to reflect the drupal version we want a solution for. This thread seems like a good place to continue the D6 discussion.
#506076: Allow multiple taxonomy term selection with simplenews to send emails to multiple mailing list ? for D5?
@Sutharsan A feature such as this might be a long way out but it still seems like a desired feature that we should except patches to. Or is this a feature that is being planned for a later 6.x-2.0 release?
There are many use-cases where this would be a great feature. ^_^
Comment #17
lilott8 commentedThis is for 5.x Versions ONLY
Here is the code that needs to be added:
Look for: "function _simplenews_send($timer = FALSE) {" aprox line 1219
add to the function parameters: $preterms = NULL
Should look like:
<?php function _simplenews_send($timer = FALSE, $preterms = NULL) { ?>first line within the function add:
<?php global $multiple_lists; ?>aprox line 1220in the "while($nid = db_fetch_object...)" loop
after
<?php$node = simplenews_node_prepare($nid->nid, $nid->vid, $nid->tid);?>aprox line 1237add:
Now lets move to
<?php function simplenews_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) { ?>aprox line 456we need to add a new line after the
<?php if ($node->send == TRUE) { ?>aprox line 454<?php $pre_tax = array_values($node->taxonomy); ?>then we need to edit the function call for _simplenews_send(). aprox line 455
<?php _simplenews_send(TRUE, $pre_tax[0]); ?>So the entire function should read:
We want function simplenews_validate($node) { aprox line 338
under global $valid_emails;
add the following...
This is it. It's not too terrible. Also note that this is AFTER the patch. If you do not use the patch first then I doubt this will work.
I don't know if this plays nicely with TAC. I haven't tested that.
[EDIT]
Tested with TAC, works perfectly. Just wanted to be sure.
[/EDIT]
Also important to note: That when you send multiple newsletters out, the subject line will read that of the topmost newsletters you select.
So if you had these newsletters:
Alpha
Beta
Theta
And you sent to Alpha and Beta the subject line would only show that of Alpha.
[EDIT]
When unsubscribing to a newsletter that is an aggregate, you will unsubscribe to the topmost newsletter you selected.
ie. In previous example you would only be able to unsubscribe from Alpha
[/EDIT]
ps. Please feel free to make enhancements/changes/etc to make this better :)
This is for 5.x Versions ONLY
Comment #18
Jackinloadup commented@lilott8 this is for 5.x?
Comment #19
lilott8 commentedCorrect. I will edit my post accordingly. My apologies for not stating that!
Comment #20
Jackinloadup commentedChanged version to reflect lilott8's patch.
Comment #21
theshanergy commentedAny word on a 6.x patch? This would be extremely handy functionality!
Comment #22
ruloweb commentedHi people!
I've made a patch for D6. As this issue is for D5 I created a new one. See #540432: Send a newsletter issue to multiple newsletters (D6 patch). Please test it out!
Thanks!
--
Jose Sanchez
www.deviancefactory.com
Comment #23
wmostrey commented