[xwiki-users] How can I get the name and last name from the current user in a different variables?
How can I get the name and last name from the current user in a different variables? Until now I obtain the current user with $context.user but I need the name separated from the last name. Thanks -- View this message in context: http://xwiki.475771.n2.nabble.com/How-can-I-get-the-name-and-last-name-from-... Sent from the XWiki- Users mailing list archive at Nabble.com.
If you edit your profile with the object editor you'll see there is an object of class XWiki.XWikiUsers attach to it. Use http://platform.xwiki.org/xwiki/bin/view/DevGuide/APIGuide#HAccessobjectsina... to access that object and to query its properties. Hope this helps, Marius On 08/26/2010 11:30 AM, abrante wrote:
How can I get the name and last name from the current user in a different variables? Until now I obtain the current user with $context.user but I need the name separated from the last name. Thanks
Hi, You can use the following code snippet: $!xwiki.getUserName($context.user, "$first_name", false) $!xwiki.getUserName($context.user, "$last_name", false) I hope this helps, Oana abrante wrote:
How can I get the name and last name from the current user in a different variables? Until now I obtain the current user with $context.user but I need the name separated from the last name. Thanks
Thanks a lot, works perfect :) -- View this message in context: http://xwiki.475771.n2.nabble.com/How-can-I-get-the-name-and-last-name-from-... Sent from the XWiki- Users mailing list archive at Nabble.com.
participants (3)
-
abrante -
Elena-Oana Tabaranu -
Marius Dumitru Florea