function _site_map_blogs in Site map 6
Same name and namespace in other branches
- 8 site_map.module \_site_map_blogs()
- 5 site_map.module \_site_map_blogs()
- 6.2 site_map.module \_site_map_blogs()
- 7 site_map.module \_site_map_blogs()
Render the latest blog authors.
1 call to _site_map_blogs()
- theme_site_map_display in ./
site_map.module - Return a themed site map.
File
- ./
site_map.module, line 233 - Original author: Nic Ivy Now maintained by by Fredrik Jonsson fredrik at combonet dot se
Code
function _site_map_blogs() {
$output = '';
$class = '';
if (module_exists('blog')) {
$title = t('Blogs');
$output = '<div class="description">' . t("Community blog and recent blog authors at %sn.", array(
"%sn" => variable_get('site_name', 'Drupal'),
)) . '</div>';
$blog_link = l(t('All blogs'), 'blog');
if (variable_get('site_map_show_rss_links', 1) != 0) {
$rss_link = theme('site_map_feed_icon', 'blog/feed');
if (variable_get('site_map_show_rss_links', 1) == 1) {
$blog_link .= ' ' . $rss_link;
}
else {
$class = ' sitemap-rss-left';
$blog_link = $rss_link . ' ' . $blog_link;
}
}
$blogs = array();
$blogs[] = $blog_link;
$sql = "SELECT DISTINCT u.uid, u.name, count(u.uid) AS numitems\n FROM {node} n\n INNER JOIN {users} u ON u.uid = n.uid\n WHERE n.type = 'blog' AND n.status = 1\n GROUP BY u.uid, u.name\n ORDER BY numitems DESC, u.name";
$result = db_query_range($sql, 0, 10);
while ($blog = db_fetch_object($result)) {
$blog_item = l(t("!s's blog", array(
"!s" => $blog->name,
)), "blog/{$blog->uid}") . ' (' . $blog->numitems . ')';
if (variable_get('site_map_show_rss_links', 1) != 0) {
$rss_link = theme('site_map_feed_icon', "blog/{$blog->uid}/feed");
if (variable_get('site_map_show_rss_links', 1) == 1) {
$blog_item .= ' ' . $rss_link;
}
else {
$blog_item = $rss_link . ' ' . $blog_item;
}
}
$blogs[] = $blog_item;
}
$output .= theme('item_list', $blogs);
$output = theme('site_map_box', $title, $output, 'sitemap-blog' . $class);
}
return $output;
}