Forum Discussion
Hi Colin,
Sorry for the late reply. There are two parts to this that you will need to do. The first is create a custom component that pulls the user's first and last name. Like Adam said, you can use env.context.message.author to figure out who the message author is.
<#assign allowed=rest("/users/id/${env.context.message.author?c}/profiles/name/name_first/allowed").value /> <#if allowed?trim == "true"> <#assign first_name= rest("/users/id/${env.context.message.author?c?c}/profiles/name/name_first").value!"" /> <#assign last_name= rest("/users/id/${env.context.message.author?c?c}/profiles/name/name_last").value!"" /> </#if> ${first_name} ${last_name}
The first part of this look to see if the current user has permission to see the author's profile information. Next, it amakes rest calls to get that information. Lastly, it displays the first and last names.
The second part is to add this new component to the ForumMessage page in studio. I'm having a hard time finding it myself so you may need to ask support to do that (or maybe I'm just going blind).
Hi Kaela,
I tried using this in studio but I am being given an error message, essentially what I did was:
1. Create a new custom content module and pasted in the code you outlined above,
2. Adding a custom component on the forum message page.
When I view a forum message, I'm shown an error message, this bit below is a segment of that:
Expression first_name is undefined on line 1, column 3 in preview. The problematic instruction: ---------- ==> ${first_name} [on line 1, column 1 in preview] ----------
Do you have any ideas for fixing this?
Thanks,
Colin
Related Content
- 6 years ago