Content by User Macro

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

This widget could not be displayed.
Timothy Chin Community Champion Sep 07, 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.

This widget could not be displayed.

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

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

And nothing is displayed in 5.8.9.

Stephen Deutsch Community Champion Sep 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 Community Champion Sep 14, 2015

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

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

Davin Studer Community Champion Sep 15, 2015

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

This widget could not be displayed.

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 Community Champion Sep 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 Community Champion Sep 14, 2015

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

Davin Studer Community Champion Sep 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.

This widget could not be displayed.

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 Community Champion Sep 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.

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.

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

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

This widget could not be displayed.

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?

This widget could not be displayed.

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

 

 

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

460 views 6 6
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you