I'm using SimpleNews on Drupal 5.5 with MimeMail and the template modules. It's working great except for a little more functionality I desire.

Is there any way to automatically link to the newsletter node online? For example, text at the top of the newsletter would say "Having trouble viewing this? READ ONLINE" and it would link to the published node.

Comments

Anonymous’s picture

subscribing. I have no experience with this mod but I might want to use it in the future.

keylope’s picture

In your template.php, copy this from simplenews.module file (I am running the most current version of simplenews) and make sure to change theme to the name of your theme.

function theme_simplenews_newsletter_footer($node, $hash) {
  if ($node->s_format == 'html') {
    $node->body .= '<p>-- <br />'. l(t('Click here to unsubscribe from this newsletter'), 'newsletter/confirm/remove/'. $hash, array(), NULL, NULL, TRUE) .'</p>';
  }
  else {
    $node->body .= "\n\n-- \n". t('Unsubscribe from this newsletter: @url', array('@url' => url('newsletter/confirm/remove/'. $hash, NULL, NULL, TRUE)));
  }
  return $node;
}

Then you can modify it to add all base url, path, and node path like this:

function <MYTHEMENAME>_simplenews_newsletter_footer($node, $hash) {
  global $base_url;
  if ($node->s_format == 'html') {
    $node->body .= '<p>-- <br />If you are having trouble reading this newsletter, you can '.l(t('read the newsletter online'), $base_url.base_path().$node->path, array(), NULL, NULL, TRUE).'.</p>';
    $node->body .= '<p>-- <br />'. l(t('Click here to unsubscribe from this newsletter'), 'newsletter/confirm/remove/'. $hash, array(), NULL, NULL, TRUE) .'</p>';
  }
  else {
    $node->body .= '\n\n-- \n'.t('Read the newsletter online: @news', array('@news' => url($base_url.base_path().$node->path, NULL, NULL, TRUE)));
    $node->body .= "\n\n-- \n". t('Unsubscribe from this newsletter: @url', array('@url' => url('newsletter/confirm/remove/'. $hash, NULL, NULL, TRUE)));
  }
  return $node;
}

If you want to put this at the top, you can copy the header function instead of the footer.

This won't work if you create a newsletter and send it at the same time. This is because the node->path is empty as there isn't a node created yet. I don't know if that can be changed, but to work around it, simply save a draft of the newsletter and do not send it out. Once the draft is saved, you can send it and the node->path will become available and populate correctly.

I hope that helps!

3cwebdev’s picture

Awesome, I will definitely try this out when I get a chance. Thanks for posting!

Complete Computer Care

keylope’s picture

I just came across that need to have that yesterday. For some reason, I thought it was already there... I've submitted a feature request ticket on simplenews to see if it's possible to get the node->path when doing a create/send in one step. You can view the ticket here. http://drupal.org/node/325320

AntiNSA’s picture

Ok, I have been killing myself trying to figure this out for the past week...

i have tried to create a view, I have tried to create new content type... and I have tried every setting in the module pages...

Here is the procedure I do:

I have three questions , so I am going to break this up into three posts. Im not sure if the questions could be answered with one solution, or not. If so please forgive me for double posting.

Here is a breakdown of what I know and what think I know:
========================
What I have
1.Its difficult to do research on this subject as so many use the terminology loosely between outgoing and incoming feeds. When I think I might have found information about about how to organize incoming feeds, I am sad to find out that what I found was information for out going feeds.

2. My current Drupal setup has the following modules installed and running:

Common syndication parser
FeedAPI Inherit
FeedAPI Mapper
FeedAPI
FeedAPI Node
SimplePie parser

I tried to install simplefeed, ut as I am running drupal 6 its not an option, and Drigg looks cooll, but also doesnt work for 6.

3. I have Php 5x and drupal 6 (upgrading tonight to 6.6)

What I know about the layout of incoming feeds
1. When I go to add a new feed and category of feed type; by going to administrator--->content management---->Feed Aggregator-----> Add feed or Add category

2. Drupal creates a block with the newest feed titles from my
feed entered and a new block with the newest headlines from the category created which that feed is in.

Thats a great start. However...

A. I cant find anywhere where the formatting of these blocks or configuration of the information in those blocs are kept. I have tried looking in content type and views. I have played and played, and cant figure out where that stuff is coming from.

B. Not only is there a block with the headlines... (I mean is it really a block, or is it a node? I guess it is a block since it is in the block area and you can show it on different nodes...) It creates a page you can go to when you click on the more link.. Where is this page created? I cant find it in content type when you click on administrator--->content type

C. When you click on this is is under the aggregator/categories/ directory.... So this is a Category type?

D. When you click on the configure link there is only the title and body option... how do I change the configuration of all the otherstuff on the categories page with the feed on it? How can I elect to allow comments, etc? I tried playing with all the default view settings and the content type settings and couldnt find where to do this.

Here is exactly what I want to do:

1. If drupal has created its own blocks automatically, why cant I?

I have tried for two weeks to do this and watched every youtube vid, downloaded drupal videos from bt, almost broke google searching for the way.... I would like to have a block with feeds listed like @ http://www.momblognetwork.com/

Feed title/feed teaser, 5 w's, link to source, link to read more, comments , etc. all that jazz.

Please dont say "Use Views" I have tried and searched for every tutorial and played and played to I felt like I was the most worthless person on this planet and would never be able to feed my own children. I mean completely hopeless like I should give up computers.

How do I get that black like drugal makes? I want to make that and customize it.

Why does Drupal make the links for the headlines in the block go to the source, instead of to the read more page?
On the mom blog page they have the source and the links go to the read more. I am not in a hurry to send them away from my site.

E. I have memorized the learn by the drop youtube vid. Watched it over and over to my eyes were red. I hate the guy. How he shows you everything so generally in ten minutes and when I try to walk through the vid, frame by frame, day after day, I cant find away to create a block with the newest feeds. I mean from all categories. or any category.....

f. This is one of the other greatest secrets of drupal

Where the hell are the settings to alter the template for the blog this Icon? Why have it on only block with the 20 blogs????

WHy not have that Icon on the page/read more link visable to Admin? I mean after 20 feeds in the block it is impossible to blog the feed.... And its great to read the whole content as much as possible before blogging it.....

Why is this so secretive?t drupal. Everytime I think I find

I am really excited about Drupal!
Every time I think I find a video that is going to teach me how to use drupal better, It turns out to only be a group of developers discussing how cool it is and what it can do..... but not how... not specifically.

I understand it is dynamic... I understand it is possible....

Please show me the way by answering this mystery which is sucking up my life.......

I feel guilty... like I have been playing a video game for days or something like when I was younger, however Im an old mman with two kids to feed. Please let me know the way.

Please cut up and reply to this long post between the lines. I really am interested in this and ... I dont know. Maybe its time to sell my soul or children....

Please Drupal people.....

I mean Drupal is so great... But the simple things... like finding the own threads which you started in this forum is a difficult process....

Robert
www.thecenterofthenet.com/dp/

Subscribe