From: stephen@cubedesigners.com Date: Tue, 16 Jun 2020 14:03:20 +0000 (+0000) Subject: Prevent error when no author is set for a post. WIP #3641 @0.25 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=c14ead9853c57c31cb15f515111b7cedb78dfdba;p=fluidbook-v3.git Prevent error when no author is set for a post. WIP #3641 @0.25 --- 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