mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-02 14:18:46 +02:00
Merge pull request #2096 from CheeseSucker/patch-1
ENHANCEMENT: Allow programmers to set OwnerID for new files.
This commit is contained in:
commit
40eed9e902
@ -466,7 +466,9 @@ class File extends DataObject {
|
|||||||
parent::onBeforeWrite();
|
parent::onBeforeWrite();
|
||||||
|
|
||||||
// Set default owner
|
// 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
|
// Set default name
|
||||||
if(!$this->getField('Name')) $this->Name = "new-" . strtolower($this->class);
|
if(!$this->getField('Name')) $this->Name = "new-" . strtolower($this->class);
|
||||||
|
Loading…
Reference in New Issue
Block a user