display author / creator as property

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

display author / creator as property

Helenc
This post has NOT been accepted by the mailing list yet.
Hi,

I'm very new to xwiki. Thanks so far to everyone that is contributing...

I have created a new class. And I would like to include author as a property in the class, and have it automatically populate with the user's name.

I tried looking at comment class but couldn't see how this get's done.

Could someone help me out?

Reply | Threaded
Open this post in threaded view
|

Re: display author / creator as property

Bubulina
This post has NOT been accepted by the mailing list yet.
Hello,

You can get the local username using this line of code: $context.getLocalUser().
If u have a list of pages, and want to include the author of those pages...so the author will be different for some pages, i recomend looking at: Main.RecentChanges page.

All i tried so far was to get the date of the creation of a page:
#set($rcDoc = $xwiki.getDocument($subdoc))
#set($rcDt = $xwiki.jodatime.getDateTime($rcDoc.getDate().getTime()))
#set($documentDate = $xwiki.formatDate($rcDt.toDate(), "dd/MM/yyyy HH:mm:ss"))
Maybe getting the user is something similar. Good luck

This is after looking the page above.
Helenc wrote
Hi,

I'm very new to xwiki. Thanks so far to everyone that is contributing...

I have created a new class. And I would like to include author as a property in the class, and have it automatically populate with the user's name.

I tried looking at comment class but couldn't see how this get's done.

Could someone help me out?