Forum Discussion
Yes, you can do that. Here is the way to get the value from custom content.
https://community.lithium.com/t5/Custom-Content/Getting-Custom-Content-via-the-REST-API/ta-p/90582
Just get the value and compare.
Thanks VikasB
I'd seen that article when figuring out how to access the custom content.
Which method would you recommend for checking if there's a variable within that, say checking if customcontent.#_text contains users.role, for example?
- VikasB8 years agoBoss
If there is a different role for different node, then you need to use below code using corNode id
<#assign content =
restadmin("/boards/id/${coreNode.id}/settings/name/customcontent.#_text").value
/>If checking for just same role on all the nodes then you can just use this one
<#assign content =
restadmin("/settings/name/customcontent.#_text").value
/>- Kev_B8 years agoAdvisor
Thanks VikasB,
Although maybe we're not on the same page? The component will be testing if there's a role declared within customcomponent.#_text, similar to....
if customcomponent.#_text contains a users.role and it matches the current users.role display customcomponent.#_title and text with appropriate HTML else do not display anything
The custom component text field would then be declaring different roles and a unique message
if users.role = "beginner" display "Welcome to the Community" elseif users.role = "expert" display "Welcome back"
That's not specific to what I'm trying to do, but the best way I can think to elaborate on what I'm trying to achieve.
Thanks again for all your help.
- VikasB8 years agoBoss
Get value from Custom Content #
<#assign role =restadmin("/settings/name/customcontent.#_text").value />
Compare it with user role
<#if role == 'Beginner' > Welcome <#elseif role=='Expert'> Welcome Back <#else> <#--Nothing to display -> </#if>
Hope, you are trying to do something similar. LMK if you want something else.
Related Content
- 8 days ago
- 2 months ago
- 2 months ago
- 2 months ago
- 2 months ago