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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Save the member on editing a dataobject

Go to End

3 Posts   782 Views


Community Member, 56 Posts

1 March 2012 at 3:24am

Edited: 01/03/2012 3:34am

Hi and Hello.

I've got a dataobject (projects) on a webpage. And there are a bunch of editors allowed to edit this dataobjects. My client want to see, which single dataobject item is edited by which editor (currentMember). So what i need is a startingpoint (or a simple tutorial) to get this problem solved.
It is neccesary to use a hook like onBeforeWrite()? Is there something like "lasteditedby"?

I guess its a simple task but i dont got a clue where to start. Thanks a lot, Pipifix


Community Member, 175 Posts

1 March 2012 at 6:39am


you can add a new field to the dataobject, for example "lasteditby"

and then set a value for it with onBeforeWrite()

function onBeforeWrite() {
if( $member = Member::currentUser() ) {
   $this->lasteditby = $member->ID;


dont tested this, but should point to right direction...


Community Member, 56 Posts

1 March 2012 at 10:59pm

Hi danzzz

Thanks for your response. I'll give it a try.