Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Display Username for 'Last Modified By' document property View modes: 
User avatar
Member
Member
lawrence.dine-moov2 - 12/17/2012 12:01:44 PM
   
Display Username for 'Last Modified By' document property
We need to display the Username for the user that last modified a document using a transformation.

After much googling, looking through the docs and searching this forum we still can't figure out how to do this.

Any pointers?

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 12/17/2012 3:39:11 PM
   
RE:Display Username for 'Last Modified By' document property
Not sure where you need to display this but a simple macro of
{% CurrentDocument.DocumentModifiedByUser %}
will get you the user who last modified the document.

User avatar
Member
Member
lawrence.dine-moov2 - 12/18/2012 3:40:27 AM
   
RE:Display Username for 'Last Modified By' document property
Thanks for the reply. I'm trying to display the username of the user that last modified the document at the top of the page using a portal engine template. I'm currently trying to display this using a transformation that is reused across most of the content.

When I put the above line into a transformation I get this on the page:
{% CurrentDocument.DocumentModifiedByUser %}

But I assume I'm using this in the wrong place, I had a look at 'Macro Rules' in the site manager but it appears to be for creating conditional rules.

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 12/19/2012 9:01:34 PM
   
RE:Display Username for 'Last Modified By' document property
Ok use this then, assuming you are using a Document Type and the standard queries.

<%# Eval("DocumentModifiedByUser %> vs. the macro expression.

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 12/19/2012 9:02:26 PM
   
RE:Display Username for 'Last Modified By' document property
Sorry for the typo, try this:

<%# Eval("DocumentModifiedByUser") %>

User avatar
Kentico Support
Kentico Support
kentico_radekm - 12/21/2012 9:31:19 AM
   
RE:Display Username for 'Last Modified By' document property
Hello.

My co-worker Jan replied you in ticket. Just for the others, let me post here what he suggested:

I hope I am getting your request properly. If you want to display any macro in the transformation, you need to call the CMS.CMSHelper.CMSContext.CurrentResolver.ResolveMacros("{%CurrentDocument.DocumentModifiedByUser%}

Is this what you were looking for?

Best Regards,
Radek Macalik