Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,559,491
Community Members
 
Community Events
184
Community Groups

user details for macro

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

2 answers

1 vote
Stephen Deutsch
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Mar 20, 2018

Here are some of the functions available to the Confluence User object:

https://docs.atlassian.com/atlassian-confluence/6.6.0/com/atlassian/confluence/user/ConfluenceUserImpl.html

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>

thank you Stephen

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
0 votes
Roman Joss
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Apr 14, 2023

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

Roman Joss
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Apr 14, 2023

Oh, after a several more searches I've found the following bug.

CONFSERVER-82741

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events