permissions for the user biography based on user roles
- 6 months ago
I don't think this is possible out of the box but would be a fairly simple customization. Do you want to hide the biography showing on the profile page or just hide the field in settings? Or both?
On the profile page
You can create an "Override Component" that wraps the biography component with some logic to check for a role and not display the component for normal users. Override core components (khoros.com)
The biography component shown on the profile page is named users.widget.about-me so in stage you would go to studio>components and create a new component named users.widget.about-me@override
Let's say your normal users have a Role named "Normal". The following code would prevent the component from displaying for those normal users. (this is untested)
<#assign normalUser = false> <#--Get logged in user's roles and check for "Normal" role--> <#assign userRoles = (restBuilder().admin(true).liql("SELECT name FROM roles WHERE users.id = '${user.id?c}' LIMIT 100").data.items)![]/> <#list userRoles as role> <#if (role.name == "Normal")> <#assign normalUser = true /> </#if> </#list> <#if (!normalUser)> <@delegate/> </#if>
Hide the field in settings
This is a little different. The Biography field under my settings is one part of a larger component so I think I would just hide it with CSS using the same role check above.
So first create new custom component in studio named whatever you want with the code below.
<#assign normalUser = false> <#--Get logged in user's roles and check for "Normal" role--> <#assign userRoles = (restBuilder().admin(true).liql("SELECT name FROM roles WHERE users.id = '${user.id?c}' LIMIT 100").data.items)![]/> <#list userRoles as role> <#if (role.name == "Normal")> <#assign normalUser = true /> </#if> </#list> <#if (normalUser)> <style> .lia-form-row.lia-form-profile-biography-entry { display: none; } </style> </#if>
Then go to the Page tab in studio and select the My Profile Page (not to be confused with the View Profile Page). Add your new component anywhere on that page.
Hope that makes sense.