Forum Discussion

Hoekstra_VFZ's avatar
4 years ago

make a component appear only when the current environment is not-closed

Hi all,

On our Community we have closed sections where we test new products together with select users. We want to create a friendly warning when new testers are about to post outside of closed environments. This way we want to prevent leakage of sensitive information about not released products.

I need to build notifications for users with a specific role (product testers) when they are about to make a new topic - or placing a comment - outside of a closed forum. 

Here I have found Freemarker stuff to show a components for specific user roles: https://community.khoros.com/t5/Components-endpoints-and-the/Display-components-based-on-role/ta-p/42992

I did search for info on how to show components based on detection closed, hidden or open environments, but didnt find what I was looking for, so:

How can I make a component appear only when the current environment is not closed (and the user has a specific user role)?

With that figured it I can look to add it to the editor section on a topic, and add it to the new message page. Tips are welcome.

PS. I would really love to have parentnode and visibility (open, hidden, closed) added to the datalayer LITHIUM.CommunityJsonObject.Page - and userrole added to LITHIUM.CommunityJsonObject.User.

    • Hoekstra_VFZ's avatar
      Hoekstra_VFZ
      Advisor

      Jeff, thanks! Following the link you have shared I see suggestions how to make an IF statement using UserRoles and CoreNode ID's and CoreNode Ancestors.

      With this I should be able to make a component appear for Testmembers when the current node is not a test environment and they are about to write a comment.

      The real challenge will be to add a component to the postpage (start a discussion page). Can I even do that using the page and component editors in studio?

      • TedV's avatar
        TedV
        Khoros Alumni (Retired)

        Hi Hoekstra_VFZ

         

        If any of the comments answered your query, would you mind marking it as an accepted solution, please?

         

        Thanks!

  • Hi!

    You could consider doing this via a custom quilt for the topic creation page / blog post page, with a custom component or custom content component that contains the warning message you want to display.  You’d need to manually set the quilt for the closed areas.

    Maybe not the most satisfying approach, and its feasibility depends on the number of closed areas you have... but it'll work.

    Hopefully someone has a more technical / API-based answer!

    Cheers!