Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

get username from page(this)?

Kianusch June 12, 2019

hi,

 

i´m writing a usermacro in which i want to get the username from the page on which the macro is placed.

 

$user.name does not work.

 

maybe something like:

getUserFromPage(this)

 

thanks for your help

 

 

1 answer

0 votes
Thomas Schlegel
Community Champion
June 12, 2019

Hi @Kianusch ,

what do you mean by username? The creator or the last author or anything else?

Kianusch June 12, 2019

i mean the creator of the macro, but because of the fact that the macro will be used on on the users personalspace (Homepage) it can also be the user of the page on which the macro is placed

Thomas Schlegel
Community Champion
June 12, 2019

Well, the creator of the macro is always you, so why using a function for this? Just drop your name in the code of the macro.

 

If you want to get the name of the logged on user, just try

$action.getRemoteUser().getFullName()

If you want the creator of the page use this:

$content.getCreator().getFullName()

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events