"Blog-it" button on all posts
Hello
I was wondering if anyone has a customized the xxxx module (?) to achieve the following:
1. "Blog it"-button/link, appearing below all nodes (like "add comment") not only in the aggregator-block. It should copy the text into a new post just like the Blog-it button does from the block. If "perfect" it should ask which node type to "blog it as": Blog, Forum post, Book page, etc, but that can be a later variant, most important is to be able to blog any posts easily at all.
2. Blog-it button beside each item in the news aggregator listing where the teasers are shown.
Not being a PHP programmer myself, I'm looking for a bit of advice on how to customize to have this functionality.
Any help/advice is highly appreciated.

Modified this piece of code, is it correct?
Hi
I've been trying to achieve something similar.
So far I've done the some changes to the piece of code that appears in the aggregator.module-file, but I still didnt manage to see "Blog it"-button anywhere.
Could someone please review what I've done, and help me out?
***************************
/**
* Format an individual feed item for display on the aggregator page.
*
* @ingroup themeable
*/
function theme_aggregator_page_item($item) {
static $last;
$date = format_date($item->timestamp, 'custom', 'Ymd');
if ($date != $last) {
$last = $date;
$output .= '<h3>'. format_date($item->timestamp, 'custom', 'F j, Y') ."</h3>\n";
}
$output .= "<div class=\"news-item\">\n";
$output .= ' <div class="date">'. format_date($item->timestamp, 'custom', 'H:i') ."</div>\n";
$output .= " <div class=\"body\">\n";
$output .= ' <div class="title"><a href="/'. check_url($item->link) .'">'. check_plain($item->title) ."</a></div>\n";
if ($item->description) {
$output .= ' <div class="description">'. $item->description ."</div>\n";
}
/**
* I customized from here
*
*
*/
if ($user->uid && module_exist('blog') && user_access('edit own blog')) {
if ($image = theme('image', 'misc/blog.png', t('blog it'), t('blog it'))) {
$output .= '<div class="icon">'. l($image, 'node/add/blog', array('title' => t('Comment on this news item in your personal blog.'), 'class' => 'blog-it'), "iid=$item->iid", NULL, FALSE, TRUE) .'</div>';
}
}
if ($item->ftitle && $item->fid)
/**
* I customized to here
*
*
*/
{
$output .= ' <div class="source">'. t('Source') .': '. l($item->ftitle, "aggregator/sources/$item->fid") ."</div>\n";
}
$result = db_query('SELECT c.title, c.cid FROM {aggregator_category_item} ci LEFT JOIN {aggregator_category} c ON ci.cid = c.cid WHERE ci.iid = %d ORDER BY c.title', $item->iid);
$categories = array();
while ($category = db_fetch_object($result)) {
$categories[] = l($category->title, 'aggregator/categories/'. $category->cid);
}
if ($categories) {
$output .= ' <div class="categories">'. t('Categories') .': '. implode(', ', $categories) ."</div>\n";
}
$output .= " </div>\n";
$output .= "</div>\n";
return $output;
}
**********************************************
This Solution Worked For Me
I just copied and pasted the "blog it" lines from the block section of the module to the page_item section. I think you did the same, the difference for me is where I pasted. See below.
I tried this out in Drupal 5 first; what's pasted below is what I ended up with in 4.7. The difference between 5 and 4.7? 5 used a function called module_exists(), while 4.7 used module_exist().
Hope this helps :-)
/**
* Format an individual feed item for display on the aggregator page.
*
* @ingroup themeable
*/
function theme_aggregator_page_item($item) {
$source = '';
if ($item->ftitle && $item->fid) {
$source = l($item->ftitle, "aggregator/sources/$item->fid", array('class' => 'feed-item-source')) . ' -';
}
if (date('Ymd', $item->timestamp) == date('Ymd')) {
$source_date = t('%ago ago', array('%ago' => format_interval(time() - $item->timestamp)));
}
else {
$source_date = format_date($item->timestamp, 'custom', variable_get('date_format_medium', 'D, Y-m-d H:i'));
}
$output .= "<div class=\"feed-item\">\n";
$output .= '<h3 class="feed-item-title"><a href="'. check_url($item->link) .'">'. check_plain($item->title) ."</a></h3>\n";
$output .= "<div class=\"feed-item-meta\">$source <span class=\"feed-item-date\">$source_date</span></div>\n";
if ($item->description) {
$output .= '<div class="feed-item-body">'. aggregator_filter_xss($item->description) ."</div>\n";
}
$result = db_query('SELECT c.title, c.cid FROM {aggregator_category_item} ci LEFT JOIN {aggregator_category} c ON ci.cid = c.cid WHERE ci.iid = %d ORDER BY c.title', $item->iid);
$categories = array();
while ($category = db_fetch_object($result)) {
$categories[] = l($category->title, 'aggregator/categories/'. $category->cid);
}
if ($categories) {
$output .= '<div class="feed-item-categories">'. t('Categories') .': '. implode(', ', $categories) ."</div>\n";
}
# add the "blog it" button to the feed page, not just blocks!
global $user;
if ($user->uid && module_exist('blog') && user_access('edit own blog')) {
if ($image = theme('image', 'misc/blog.png', t('blog it'), t('blog it'))) {
$output .= '<div class="links">'. l('Blog This', 'node/add/blog', array('title' => t('Comment on this news item in your personal blog.'), 'class' => 'blog-it'), "iid=$item->iid", NULL, FALSE, TRUE) .'</div>';
}
}
$output .= "</div>\n";
return $output;
}