Commit ee1fd0e5 authored by Joakim Schramm's avatar Joakim Schramm

Made bloginfo block show also on the blog root parent e.g. blog/1 and not only on a blog node page.

parent eb9e6bc9
......@@ -62,22 +62,27 @@ function bloginfo_block($op = 'list', $delta = 0, $edit = array()) {
);
return $blocks;
}
else if ($op == 'view') {
elseif ($op == 'view') {
switch ($delta) {
case 'bloginfo':
if ($node = menu_get_object());
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;
if ($node = menu_get_object()) {
if ($node->type == 'blog') {
$authorid = $node->uid;
}
}
elseif (arg(0) == 'blog' && is_numeric(arg(1))) {
$authorid = arg(1);
}
if (!empty($authorid)) {
$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;
}
}
break;
case 'blogroll':
$results = db_query("SELECT uid, title FROM {bloginfo} WHERE title <> '' ORDER BY title ASC");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment