7912 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Add name of member who uploaded file to file object
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 687 Views |
-
Add name of member who uploaded file to file object

9 June 2009 at 6:54pm
Hi guys,
I am using the FileDataObjectManager to upload documents but wondered how to record the name of the user who uploads the file into the data object. I can do this using a front end form by doing something similar to this:
In the form submit function:
$member = Member::currentUser();
$firstname = $member->FirstName;
$lastname = $member->Surname;
$image->UploadMember = $firstname . " " . $lastname;But I'm no sure how to do it with the objectmanager. Any ideas? Thanks
-
Re: Add name of member who uploaded file to file object

10 June 2009 at 3:12am
Good idea. Put it in Feature Requests.
-
Re: Add name of member who uploaded file to file object

10 June 2009 at 11:44am
Hey UncleCheese, I'm not sure if is worth putting it in as a feature request as it is actually super easy to do - I just added this to my dataobject class:
public function populateDefaults(){
parent::populateDefaults();
$Name = Member::currentUser();
$firstName = $Name->FirstName;
$lastName = $Name->Surname;$this->UploadMember = $firstName.' '.$lastName;
}Might be useful for someone else
-
Re: Add name of member who uploaded file to file object

10 June 2009 at 1:58pm
Yeah, but it should do that out of the box. Every other file upload interface in SS does it.
| 687 Views | ||
|
Page:
1
|
Go to Top |
