Re: [xwiki-users] display author / creator as property
Hi Helenc, On Fri, Dec 11, 2009 at 12:54 PM, Helenc truck...@hotmail.com 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. You don't really need to do that since the document already stores the page's creator name and the name of the last person who modified it. You can access them through $doc.author and $doc.creator . Alternatively you can add an author field to your class and have it populated using the value returned by $context.user . Hope this helps, Guillaume I tried looking at comment class but couldn't see how this get's done. Could someone help me out? -- View this message in context: http://n2.nabble.com/display-author-creator-as-property-tp4150822p4150822.html Sent from the XWiki- Users mailing list archive at Nabble.com. ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Guillaume Lerouge Product Manager - XWiki SAS Skype: wikibc Twitter: glerouge http://guillaumelerouge.com/ ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] display author / creator as property
Thanks. That's very helpful!! Now I have an extra property in my class which I can't delete - how I can I hide it? I've tried renaming it unused_author but it still appears? Thanks On 11/12/2009, at 2:16 PM, Guillaume Lerouge [via XWiki] wrote: Hi Helenc, On Fri, Dec 11, 2009 at 12:54 PM, Helenc [hidden email] 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. You don't really need to do that since the document already stores the page's creator name and the name of the last person who modified it. You can access them through $doc.author and $doc.creator . Alternatively you can add an author field to your class and have it populated using the value returned by $context.user . Hope this helps, Guillaume I tried looking at comment class but couldn't see how this get's done. Could someone help me out? -- View this message in context: http://n2.nabble.com/display-author-creator-as-property-tp4150822p4150822.html Sent from the XWiki- Users mailing list archive at Nabble.com. ___ users mailing list [hidden email] http://lists.xwiki.org/mailman/listinfo/users -- Guillaume Lerouge Product Manager - XWiki SAS Skype: wikibc Twitter: glerouge http://guillaumelerouge.com/ ___ users mailing list [hidden email] http://lists.xwiki.org/mailman/listinfo/users View message @ http://n2.nabble.com/display-author-creator-as-property-tp4150822p4151197.html To unsubscribe from display author / creator as property, click here. -- View this message in context: http://n2.nabble.com/display-author-creator-as-property-tp4150822p4151529.html Sent from the XWiki- Users mailing list archive at Nabble.com. ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] display author / creator as property
Hi Helenc, On Fri, Dec 11, 2009 at 3:19 PM, Helenc truck...@hotmail.com wrote: Thanks. That's very helpful!! Now I have an extra property in my class which I can't delete - how I can I hide it? I've tried renaming it unused_author but it still appears? Unfortunately property deletion doesn't work yet. You've got 2 choices: - Recreate your class from scratch - Modify the Sheet page to tell it not to display the useless property. If you didn't change the standard one, you can add an #if check before the property: #foreach($prop in $class.properties) #if($prop.getName() != unused_author) ; $prop.prettyName : $doc.display($prop.getName()) #end #end might work. Good luck, Guillaume Thanks On 11/12/2009, at 2:16 PM, Guillaume Lerouge [via XWiki] wrote: Hi Helenc, On Fri, Dec 11, 2009 at 12:54 PM, Helenc [hidden email] 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. You don't really need to do that since the document already stores the page's creator name and the name of the last person who modified it. You can access them through $doc.author and $doc.creator . Alternatively you can add an author field to your class and have it populated using the value returned by $context.user . Hope this helps, Guillaume I tried looking at comment class but couldn't see how this get's done. Could someone help me out? -- View this message in context: http://n2.nabble.com/display-author-creator-as-property-tp4150822p4150822.html Sent from the XWiki- Users mailing list archive at Nabble.com. ___ users mailing list [hidden email] http://lists.xwiki.org/mailman/listinfo/users -- Guillaume Lerouge Product Manager - XWiki SAS Skype: wikibc Twitter: glerouge http://guillaumelerouge.com/ ___ users mailing list [hidden email] http://lists.xwiki.org/mailman/listinfo/users View message @ http://n2.nabble.com/display-author-creator-as-property-tp4150822p4151197.html To unsubscribe from display author / creator as property, click here. -- View this message in context: http://n2.nabble.com/display-author-creator-as-property-tp4150822p4151529.html Sent from the XWiki- Users mailing list archive at Nabble.com. ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Guillaume Lerouge Product Manager - XWiki SAS Skype: wikibc Twitter: glerouge http://guillaumelerouge.com/ ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users