[xwiki-users] Find the email of a user
Hello, Happy new year to everyone. I'm trying to have the email of an user and I want to put it on every document the user creates. For that, I try this two differents codes : #set($mail=$xwiki.getUser($doc.getCreator(), false).getEmail()) and an other try : #set($user=$xwiki.getUser($doc.getCreator(), false)) #set($mail=$user.getEmail()) But none of this two codes is right. What should I do to have the email of my user ? Best regards, Stéphanie -- View this message in context: http://xwiki.475771.n2.nabble.com/Find-the-email-of-a-user-tp7146566p7146566... Sent from the XWiki- Users mailing list archive at Nabble.com.
Hi Stéphanie, alternatively, you can try using the more classic XWiki way - I think something like this should work : #set($usrDoc = $xwiki.getDocument($context.user)) #set($usrObj = $usrDoc.getObject('XWiki.XWikiUsers')) #set($emailProp = $usrObj.get('email').value) $emailProp Guillaume 2012/1/3 Stéphanie <[email protected]>
Hello,
Happy new year to everyone.
I'm trying to have the email of an user and I want to put it on every document the user creates.
For that, I try this two differents codes :
#set($mail=$xwiki.getUser($doc.getCreator(), false).getEmail())
and an other try :
#set($user=$xwiki.getUser($doc.getCreator(), false)) #set($mail=$user.getEmail())
But none of this two codes is right. What should I do to have the email of my user ?
Best regards, Stéphanie
-- View this message in context: http://xwiki.475771.n2.nabble.com/Find-the-email-of-a-user-tp7146566p7146566... Sent from the XWiki- Users mailing list archive at Nabble.com. _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Guillaume Lerouge Sales - XWiki SAS Skype: wikibc Office: +33 1 45 42 40 90 Mobile: +33 6 10 79 76 70
Thank you for your response, but in fact it's a bit more difficult I think. Because, I working on a form. When someone wants to complete this form, he has to click on a button that creates a new page and every form/pages are created with a default sheet. So for each new form created, I want to have the email address on the bottom of this page (I created a hidden part just for the administrators). So, I just want to get the email of each creator of a page. -- View this message in context: http://xwiki.475771.n2.nabble.com/Find-the-email-of-a-user-tp7146566p7146724... Sent from the XWiki- Users mailing list archive at Nabble.com.
Hi Stéphanie If I understand correctly you just have to replace $context.user in Guillaume's code snippet with $doc.getCreator() The document creator field contains the document's full name of the creating user. Hope this helps Edo 2012/1/3 Stéphanie <[email protected]>:
Thank you for your response, but in fact it's a bit more difficult I think.
Because, I working on a form. When someone wants to complete this form, he has to click on a button that creates a new page and every form/pages are created with a default sheet. So for each new form created, I want to have the email address on the bottom of this page (I created a hidden part just for the administrators). So, I just want to get the email of each creator of a page.
-- View this message in context: http://xwiki.475771.n2.nabble.com/Find-the-email-of-a-user-tp7146566p7146724... Sent from the XWiki- Users mailing list archive at Nabble.com. _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
participants (3)
-
Edo Beutler -
Guillaume Lerouge -
Stéphanie