Active
Project:
Blog Information
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
26 Mar 2008 at 13:40 UTC
Updated:
18 Mar 2010 at 20:31 UTC
This isn't exactly a feature request - I wanted to have the module create a block even if the user hadn't given his blog a title, for design consistency. Thought I'd share with others who might be interested, and suggest that something like this be incorporated into future versions...
It's a simple modification to bloginfo_block():
function bloginfo_block($op = 'list', $delta = 0) {
if ($op == 'list') {
$blocks[0]['info'] = t('Blog information');
return $blocks;
}
else if ($op == 'view') {
if (arg(0) == 'node' && is_numeric(arg(1))) $node = node_load(arg(1));
if (((arg(0) == 'blog' && is_numeric(arg(1))) || $node->type == 'blog')) {
if (arg(0) == 'blog') $authorid = arg(1);
else if ($node->type == 'blog') $authorid = $node->uid;
$count = db_result(db_query("SELECT COUNT(*) FROM {bloginfo} WHERE uid = %d", $authorid));
if ($count == 1) {
$results = db_query("SELECT title, description, format FROM {bloginfo} WHERE uid = %d", $authorid);
$bloginfo = db_fetch_object($results);
$block['subject'] = check_plain($bloginfo->title);
$block['content'] = theme('bloginfo_block', $bloginfo->description, $bloginfo->format, $authorid);
return $block;
}
else {
$block['subject'] = t("@blogname's blog", array('@blogname' => $node->name));
$block['content'] = ' ';
return $block;
}
}
}
}
Obviously you can put something into the content element if you want, I just wanted that blank for my users.
Comments
Comment #1
vikingew commentedNo new features in D5 version so moving it forward for later consideration. Fell free to rerole the code snippet against 6.x-1.x-dev or even better give a patch.
Comment #2
vikingew commentedAnyone using this module in need of this?