code/model/BlogPost.php
public function onBeforePublish() {
		if ($this->dbObject('PublishDate')->InPast() && !$this->isPublished()) {
			$this->setCastedField("PublishDate", time());
			$this->write();
		}
	}
public function onBeforePublish() {
		if ($this->dbObject('PublishDate')->InPast() && !$this->isPublished()) {
			$this->setCastedField("PublishDate", time());
			$this->write();
		}
	}
public function onBeforePublish ( ) { if ( $ this -> dbObject ( 'PublishDate' ) -> InPast ( ) && ! $ this -> isPublished ( ) ) { $ this -> setCastedField ( "PublishDate" , time ( ) ) ; $ this -> write ( ) ; } }
Update the PublishDate to now, if being published for the first time, and the date hasn't been set to the future.
Update the PublishDate to now if being published for the first time and the date hasn t been set to the future .