From 611865f88f8d69a4bd541b086b4e6d579efb459d Mon Sep 17 00:00:00 2001 From: Phill Price Date: Fri, 24 Oct 2014 13:29:25 +0100 Subject: [PATCH] BlogEntry:: populateDefaults stops Member from being extended as dev/build runs and this select can't find the field, as its not finished adding the fields. Also Fixed SS_Datetime as @dhenby request --- code/BlogEntry.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index a1d87c5..7c483c2 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -49,8 +49,11 @@ class BlogEntry extends Page { public function populateDefaults(){ parent::populateDefaults(); - $this->setField('Date', date('Y-m-d H:i:s', strtotime('now'))); - $this->setField('Author', Member::currentUser() ? Member::currentUser()->getName() : ''); + $requestedDevBuild = (stripos(Controller::curr()->request->getURL(), 'dev/build') === 0); + if($requestedDevBuild){ + $this->setField('Date', SS_Datetime::now()-> Rfc2822()); + $this->setField('Author', Member::currentUser() ? Member::currentUser()->getName() : ''); + } } function getCMSFields() {