The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

How can I embed the lower case name of the logged in user into some text?

Simon Hardy-Francis
August 22, 2011

I want some kind of mechanism so that I can embed a URL into a confluence page wiki markup so that the user name is dynamic, e.g. if I'm logged in as 'Simon Hardy-Francis' then I want the URL to read http://example.com/simon/blah and if I'm logged in as 'Joe Smith' I want the URL to read http://example.com/joe/blah. Is it possible to use some kind of macro in the wiki markup to achieve this? Thanks, Simon

4 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Answer accepted
David at David Simpson Apps
Atlassian Partner
August 22, 2011

Create a user macro {first-word-in-display-name} containing this (with no spaces before or after):

$action.remoteUser.displayName.toLowerCase().replaceAll("\s(.*)","")

Then you can use:

http://example.com/{user-first-name-to-lower-case}/foo</pre<>>
David at David Simpson Apps
Atlassian Partner
August 22, 2011

This assumes you want the first name

i.e.

  • Simon Hardy-Francis => simon
  • Joe Bloggs => joe


0 votes
Kevin Buchs
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 Champions.
August 22, 2011

With a reasonable number of users on a fixed list, I would suggest that {show-if} would work and could be used to create working hyperlinks. Some script or programming editor can be used to generate the list. This macro will cause the enclosed contents to only be shown to the listed user. You would need one of these for each user.

0 votes
David Peterson
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 Champions.
August 22, 2011

Hi Simon,

You can use the Reporting Plugin or the Replace and Render plugin in combination with the User Info Plugin (I think). I'm not so familiar with the latter two, so here's the Reporting Plugin method:

{report-on:injected=true}http://example.com/%global:current user > user:name%/blah{report-on}

Hope that helps!

Regards,

David Peterson

0 votes
Kevin Buchs
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 Champions.
August 22, 2011

You want to create a valid hyper-linked URL or just some text? How many users? Is the list known and fixed?

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

TAGS
AUG Leaders

Atlassian Community Events