Merge pull request #2096 from CheeseSucker/patch-1

ENHANCEMENT: Allow programmers to set OwnerID for new files.
This commit is contained in:
Ingo Schommer 2013-06-14 11:36:35 -07:00
commit 40eed9e902

View File

@ -466,7 +466,9 @@ class File extends DataObject {
parent::onBeforeWrite();
// Set default owner
if(!$this->ID) $this->OwnerID = (Member::currentUser() ? Member::currentUser()->ID : 0);
if(!$this->ID && !$this->OwnerID) {
$this->OwnerID = (Member::currentUser() ? Member::currentUser()->ID : 0);
}
// Set default name
if(!$this->getField('Name')) $this->Name = "new-" . strtolower($this->class);