How to have author name (possibly with link-back to site) show up in leached articles
BryanPflug - May 14, 2007 - 00:26
| Project: | Leech |
| Version: | 5.x-1.x-dev |
| Component: | leech |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
I think Leech is great, but at present, it's representing input leached from other sites as being authored by whoever setup the feed. It seems like for attribution, there ought to be a way that the author listed under the Leech form should be entered instead, possibly with a linkback to the original site. Can you provide this capability, help me understand how to do it using existing functionality (if that's possible), or outline what the steps would be to attempt this myself (theme templates, etc)?
Thanks!

#1
hi bryan,
first, if you don't want the feed author to show up with a feed item, shut off the by-line for feed items in your drupal theme.
second, these are the steps to get the author from RSS into drupal:
1) adapt parser so that it grabs the author tag from the rss feed
2) create space where to store it to - i.e. create a column in the leech_news_item table for storing the author
3) write code in leech that takes author from parsed rss feed object and stores it to table
4) test and admire your work :)
I would love it if you could come up with a patch for that!
#2
A very good discussion.
Any updates on this?
#3
any progress..wld be nice to have
#4
you can try doing this with node_template, too. Be aware of this bug: http://drupal.org/node/164889
#5
Many of the feeds I aggregate only have one author for every item in the feed. Why doesn't leech use the "Author of feed:" field for item authorship? I was thinking that's exactly what that field would do. Is there a way to use this field, instead of patching leech to source the author of each item from the feed?
Thanks,
D.
#6
There is no existing code that does what you are requesting. But you can easily do that by using the node_template funcitonality. Add code into the node_template load text area that fetches the author from the feed and sticks it into a CCK field.
#7
Can anyone help with the php code that we would need to enter into the node_template load text area to get this to work?
#8
Another option for getting authors as tags is using feedapi (http://www.drupal.org/project/feedapi) together with the feed element mapper here: http://cvs.drupal.org/viewvc.py/drupal/contributions/sandbox/alex_b/feed... I will roll out a version of the feed element mapper soon, until then, there is only a sandbox version.
#9
I was wondering if one could do it by just adding something like this to the rss item node template:
<?phpprint t('Posted on ').format_date($node->created, 'custom', "F jS, Y") . t(' by ') . check_plain($node->leech_news->author) . " | ". t('Website:'). check_plain($node->leech_news->link) ;
?>
However Ive had no luck with it - any clues why? my (probably naive) reasoning was that since leech inserts an entry for the author and the site URL into the rss item node table, they should be readily accessible to the template.
#10
Here is the template file I use for my leeched rss content. In my case, I'm just linking to the rss source node, which in turn can be used to get to the original feed, but it meets my needs, and might help you use this as a place to start.
<div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?>">
<?php print $picture ?>
<?php if ($page == 0): ?>
<h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php endif; ?>
<?php if ($taxonomy): ?>
<div class="terms"><?php print $terms ?></div>
<?php endif;?>
<?php if ($submitted): ?>
<span class="submitted"><?php print t('!date — !username', array('!username' => l($node->leech_news_item->feed_title,'node/'.$node->leech_news_item->fid), '!date' => format_date($node->created))); ?></span>
<?php endif; ?>
<div class="content"><div class="content-rss">
<?php print $content ?>
</div></div>
<div class="clear-block clear">
<div class="meta">
</div>
<?php if ($links): ?>
<div class="links"><?php print $links; ?></div>
<?php endif; ?>
</div>
</div>