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

This commit is contained in:
Phill Price 2014-10-24 13:29:25 +01:00
parent 638b309b69
commit 611865f88f

View File

@ -49,8 +49,11 @@ class BlogEntry extends Page {
public function populateDefaults(){ public function populateDefaults(){
parent::populateDefaults(); parent::populateDefaults();
$this->setField('Date', date('Y-m-d H:i:s', strtotime('now'))); $requestedDevBuild = (stripos(Controller::curr()->request->getURL(), 'dev/build') === 0);
$this->setField('Author', Member::currentUser() ? Member::currentUser()->getName() : ''); if($requestedDevBuild){
$this->setField('Date', SS_Datetime::now()-> Rfc2822());
$this->setField('Author', Member::currentUser() ? Member::currentUser()->getName() : '');
}
} }
function getCMSFields() { function getCMSFields() {