From c14ead9853c57c31cb15f515111b7cedb78dfdba Mon Sep 17 00:00:00 2001 From: "stephen@cubedesigners.com" Date: Tue, 16 Jun 2020 14:03:20 +0000 Subject: [PATCH] Prevent error when no author is set for a post. WIP #3641 @0.25 --- .../controllers/BlogpostController.php | 5 +++- .../application/views/helpers/BlogBody.php | 23 +++++++++---------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/framework/application/controllers/BlogpostController.php b/framework/application/controllers/BlogpostController.php index 6795770..dcd63bb 100644 --- a/framework/application/controllers/BlogpostController.php +++ b/framework/application/controllers/BlogpostController.php @@ -33,8 +33,11 @@ class BlogpostController extends CubeIT_Controller_PageController { $post = reset($post); $post = $post->unserialize(); + // Author details + $author = $post->getAuthorModel() ? $post->getAuthorModel()->unserialize() : null; + $this->view->post = $post->unserialize(); - $this->view->author = $post->getAuthorModel()->unserialize(); + $this->view->author = $author; $this->view->headTitle($post->getTitle(), 'SET'); } diff --git a/framework/application/views/helpers/BlogBody.php b/framework/application/views/helpers/BlogBody.php index 7f04901..30fb6af 100644 --- a/framework/application/views/helpers/BlogBody.php +++ b/framework/application/views/helpers/BlogBody.php @@ -25,18 +25,17 @@ class Fluidbook_View_Helper_BlogBody extends CubeIT_View_Helper_Abstract { } // Author details - $photo = $this->imageProcess()->imageProcessGetUrl($this->author->getPhoto(), null, 120, 120); - $res .= ''; // .blog-author + if ($this->author) { + $photo = $this->imageProcess()->imageProcessGetUrl($this->author->getPhoto(), null, 120, 120); + $res .= ''; // .blog-author + } $res .= ''; // .blog-post-body $res .= ''; // .content-wrapper -- 2.39.5