Content by User Macro

Ralf Loessner September 3, 2014

Hi Experts,

who can tell me, if the parameter "username" of the macro "content by user" can be set dynamic?
I'll design a page with the user macro "content by user" an it should be displayed the content of the current user, who is loggin in and visit this page.

Is there any solution for this demand?



Thank you so much

Ralf

6 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.
September 7, 2014

Hi Ralf,

Perhaps the scripting plugin is a security issue, but how about a user macro?  If you are using confluence 5.2 or higher, this will work:

## @noparams
<ac:structured-macro ac:name="content-by-user">
  <ac:parameter ac:name="">
    <ri:user ri:userkey="${action.authenticatedUser.key}"/>
  </ac:parameter>
</ac:structured-macro>

You could call it "Content by Current User" or something like that.

Best regards,

Stephen

Anne EQS
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.
September 13, 2015

Hi,

added the user macro but unfortunately it returns the error message 'Error rendering macro 'content-created-by-current-user' : null' (Confluence 5.8.5)

Did anyone face the same problem  - and found a way to solve it?

 

BR, Anne

Milo Test
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.
September 14, 2015

And nothing is displayed in 5.8.9.

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.
September 14, 2015

I'm sorry, but I simply don't have enough time to fire up a test instance right now. Maybe I'll get a chance later in the week to try and fix it.

Davin Studer
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.
September 14, 2015

I created it in 5.5.6 and 5.8.6 and it works fine in both.

Anne EQS
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.
September 14, 2015

Finally works! You have to set the Macro Body Processing to 'Escaped' - NOT to 'No Macro Body'

Davin Studer
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.
September 15, 2015

Macro Body Processing should really be set to "No macro body" as you are not embedding anything inside the user macro.

1 vote
Timothy
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.
September 7, 2014

I know you can do it if you use the Scripting Pluigin to get the current user and then output the content by user macro as wiki.

0 votes
Sabu Nair September 18, 2015

Hi ,

I used this user-macro and got error for LDAP users. Error "rendering macro 'content-by-user' : null" . We are using confluence 5.8.6 Server and Crowd integrated with LDAP. (For Non LDAP user this user-macro worked)

## @noparams
 <ac:structured-macro ac:name="content-by-user">
 <ac:parameter ac:name="">
 <ri:user ri:userkey="${action.authenticatedUser.key}"/>
 </ac:parameter>
 </ac:structured-macro>

Is userkey for systems using LDAP/Crowd different?. Any suggestion to solve this?.

 

Thx

 

 

0 votes
Anne EQS
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.
September 14, 2015

Thanks for your help, finally got it to work. smile Now 'll start restricting it by type (page, blog post, comment) - any hints for that?

0 votes
Doug Swartz
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.
September 14, 2015

If you have the Run Self-Service Reports for Confluence plugin, embed the Content by User macro in a Run without a user form macro. Specify $current_user_id as the user.

 

This has been been tested in 5.4.4 and 5.8.6.

Davin Studer
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.
September 14, 2015

Sure that works too, but the above example is free and less involved as you need only one macro on that page that doesn't need any params.

Doug Swartz
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.
September 14, 2015

You are correct. The challenge is that user macros in Confluence aren't really user macros. They are "defined by administrator" macros. The Run Self Service Reports alternative is usable by non-administrators if the appropriate plugin is already in place. It's also easily generalizable to allow selecting from a list of users.

Sabu Nair September 22, 2015

Hi , I used this user-macro and got error for LDAP users. Error "rendering macro 'content-by-user' : null" . We are using confluence 5.8.6 Server and Crowd integrated with LDAP. (For Non LDAP user this user-macro worked) ## @noparams <ac:structured-macro ac:name="content-by-user"> <ac:parameter ac:name=""> <ri:user ri:userkey="${action.authenticatedUser.key}"/> </ac:parameter> </ac:structured-macro> Is userkey for systems using LDAP/Crowd different?. Any suggestion to solve this?. Thx

Miguel Botto June 24, 2016

Hi Sabu, I have the same issue, did you finally find a solution?

0 votes
Ralf Loessner September 7, 2014

Thank you so much, but we can't use this. it is question of security and the policy says NO.

Best regards,
Ralf

 

Davin Studer
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.
September 14, 2015

What is a question of security? The answer by Stephen Deutsch doesn't open any security holes. You are not adding in any foreign code or anything like that. It is using only built-in functionality.

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.
September 14, 2015

If I remember correctly, I think he was referring to Timothy Chin's answer :)

Davin Studer
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.
September 14, 2015

Ah ... ok! I was looking at the dates of the posts and it looked to me like he was referring to your ... kinda confused me.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events