Forum Discussion

Inactive User's avatar
Inactive User
13 years ago

Editing Blog Component

(Assuming we have already had added to our environment a custom profile field, location)... On a blog post, is there a way to add a profile field's information (such as location) to the line displayi...
  • AdamN's avatar
    AdamN
    13 years ago

    Unfortunately you're not going to be able to accomplish this with a text change alone, since this type of customization requires pulling in dynamic content. You'll need a custom component for retreiving the user's profile location, and then displaying the content. This custom component will replace the "message-header' component on the "Blog Message" page. Because the "message-header" contains a few different elements (such as the author info, date, and subject), you'll need to account for those as well.

     

    This is a very crude example component, but hopefully will get you started in the right direction:

    <#assign userLocation = rest("/users/id/${env.context.message.author.id?c}/profiles/name/userlocation").value />
    
    <@component id="subject" />
    <@component id="author" />
    | ${userLocation} |
    <@component id="post-date" />

     This doesn't have any error handling for the REST API call, so that may be something you'd want to add in. You may also need to use "restadmin" instead of "rest" depending on the permissions of that particular custom profile field. Some text string changes may needed as well get the exact result you're looking for.

     

    I hope this helps!