Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Add name of member who uploaded file to file object


4 Posts   804 Views


9 June 2009 at 6:54pm Community Member, 215 Posts

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


10 June 2009 at 3:12am 4085 Posts

Good idea. Put it in Feature Requests.


10 June 2009 at 11:44am Community Member, 215 Posts

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(){
      $Name = Member::currentUser();
      $firstName = $Name->FirstName;
      $lastName = $Name->Surname;

   $this->UploadMember = $firstName.' '.$lastName;

Might be useful for someone else :)


10 June 2009 at 1:58pm 4085 Posts

Yeah, but it should do that out of the box. Every other file upload interface in SS does it.