1

I would like to get information such as first name and surname from the profile of the users in Xwiki.How can I do? Thanks.

ahta14
  • 115
  • 3
  • 9

1 Answers1

0

Just use the (e.g. Velocity) Scripting API to get the profile page of a user and extract the user object from the page, where all the user's data is located in. From the object, just read the properties you are interested in:

{{velocity}}
#set ($userDoc = $xwiki.getDocument('XWiki.someUserName'))
#set ($userObj = $userDoc.getObject('XWiki.XWikiUsers'))
## Get some properties
#set ($firstName = $userObj.getValue('first_name'))
#set ($lastName = $userObj.getValue('last_name'))
#set ($email = $userObj.getValue('email'))
##...etc
## Display the properties in the page
**First Name**: $firstName
**Last Name**: $lastName
**Email**: $email
{{/velocity}}
Eduard Moraru
  • 770
  • 4
  • 9