Hello,
trying to find what parameters are available in user macros as below.
As in I just want the users firstname to show but cannot seem to get the syntax correct.
$action.remoteUser.name (works)
$action.remoteUser.FullName (works)
$action.remoteUser.FirstName (nothing)
$action.remoteUser.LastName (nothing)
is there any documentation showing this data?
thanks
Here are some of the functions available to the Confluence User object:
Unfortunately, there's nothing available to pull the first name, as Confluence doesn't keep track of which part of the full name is a first name, middle name, or last name. However, you could assume that it is the first word of the full name string in most cases. Therefore you could use something like this:
#set ( $fullName = $action.remoteUser.fullName )
#for ( $word in $fullName.split(" ") )
#set ( $firstName = $word )
#break
#end
<p>$firstName</p>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use #foreach, not #for (source: https://stackoverflow.com/questions/5683690/how-to-use-for-loop-in-velocity-template)
Since I'm using the user macro inline, I've skipped the <p> </p> bit.
This code works for me:
#set ( $fullName = $action.remoteUser.fullName )
#foreach ( $word in $fullName.split(" ") )
#set ( $firstName = $word )
#break
#end
$firstName
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Stephen Deutsch
Ware are on the way to update Confluence from 7.13.x to 7.19.x and I have found out that the the following code does not work in 7.19.x
$action.remoteUser.FullName
Not work mean, that exact this string is shown in the page instead of the fullname of the user.
Do you have an idea if there was a change in the code?
I have several macros with the $action-function which do not work anymore.
Thanks for your assistance.
Roman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh, after a several more searches I've found the following bug.
This is my workaround!
Most of my macroes work again and now I have to enhance the property with my needs.
Sorry for disturbing.
Regards, Roman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.