From 0e16587bc4be76e6653d4815255a30071357e773 Mon Sep 17 00:00:00 2001 From: floridave Date: Thu, 13 Sep 2012 20:32:26 -0600 Subject: [PATCH] Update 3.0/modules/author/helpers/author_block.php Rwatcher updated to work with recent versions. --- 3.0/modules/author/helpers/author_block.php | 46 ++++++++++++--------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/3.0/modules/author/helpers/author_block.php b/3.0/modules/author/helpers/author_block.php index d7477055..bae1139a 100644 --- a/3.0/modules/author/helpers/author_block.php +++ b/3.0/modules/author/helpers/author_block.php @@ -23,29 +23,35 @@ class author_block_Core { } static function get($block_id, $theme) { + $block = ""; + $item = $theme->item; - if (!$item) { - return; + + if ((!isset($theme->item)) || ($item->is_album())) { + return; } - if ($block_id != 'author' || $item->is_album() ) { - return ''; + + switch ($block_id) { + case "author": + $record = ORM::factory("author_record")->where("item_id", "=", $item->id)->find(); + + $byline = ""; + if ($record->loaded()) { + $byline = $record->author; + } + + if ($byline == '') { + $byline = author::fix($item); + } + + $block = new Block(); + $block->css_id = "g-author"; + $block->content = new View("author_block.html"); + $block->content->author = $byline; + + break; } - $record = db::build() - ->select("author") - ->from("author_records") - ->where("item_id", "=", $item->id) - ->execute() - ->current(); - - $byline = $record->author; - if ($byline == '') { - $byline = author::fix($item); - } - - $block = new Block(); - $block->content = new View("author_block.html"); - $block->content->author = $byline; - return $block; + } }