Finding out who published a page



I have created a workflow to handle accepting / rejecting pages. It works fine except for one small detail: I cannot find out who published the page.

The workflow is handling the onPagePublished event provided by EPiServer.WorkflowFoundation.Activities.OnPagePublish. The second argument (EPiServer.WorkflowFoundation.Activities.WorkflowPageEventArgs e) should have the Identity field set, but it is the empty string. For other events this seems to work. As a workaround I tried Membership.GetUser() to see who the current user is, but this returns null. I also tried loading the PageData, but while the user who created/changed the page is part of the data I don't see the publisher anywhere.

Thanks for any help.

Jul 30, 2015 10:47

I would've guessed that user got put as ChangedBy. But maybe SetChangedOnPublish needs to be true.

Are you seeing the wanted username in the Admin Change Log Tool?

Edited, Jul 30, 2015 14:27

Yes, in the Change Log Tool I see the correct username in the Publish action. Is there a way to access this information programmatically?

Jul 30, 2015 15:14

If you are inside an event I'm unsure of the timing when the logging occurs but I would guess it's doable. Haven't tried or looked into it though. You could check using some reflector tool.

The change log is normally truncated regularly and can be disabled which needs consideration. You might want to keep investigating as the whole Change Log idea shouldn't be considered good practise :)

Jul 30, 2015 15:35

Ok, thanks for your help. One more question though: I thought that 'SetChangedOnPublish' might be a good workaround, but I can't get it to work. On my base page type I overrode 'SetDefaultValues' and set SetChangedOnPublish = true.  When tracing with the debugger, it passes this point and executes the code. However, when the page is created and I examine it, this property is still false. Is there another step required?

Jul 31, 2015 10:45

Not sure of the current state and which version you are running but it's always been a bit messy to work with the the "Mark as changed" feature from code. Maybe these links will help you:

Jul 31, 2015 11:15
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.