Showing results for 
Search instead for 
Did you mean: 
Super User
Super User

How to strip out authenticated users text from display

Hello Guys, 


In one of the web page I am printing the current user role of the user using liquid template 




And it display like below. 



Is there anyway I can strip out "Authenticated Users"  and add comma (,) between all the web roles. In my case ( Napier, Edison Users) are two web roles. 

Appreciate your input on this.  Thanks 


Solution Sage
Solution Sage

Super User
Super User

Thank you @Fubar , I tried the string manipulation remove but it is throwing the following error


Liquid error: Object of type 'System.String[]' cannot be converted to type 'System.String'.





Solution Sage
Solution Sage

Are you looping user.roles (as it will probably be an array or collection)

Hi @ragavanrajan ,

@Fubar is pointing correctly that user.roles is an array of strings (as per docs), not a string. You need to loop through it:

{% for role in user.roles %}
{% comment %}Do something with the role{% endcomment %}
{{ role }}
{% endfor %}


If you find this post helpful consider marking it as a solution to help others find it.

Helpful resources

Carousel Community Blog

Check out the Community Blog

Read all about the most recent blogs in the community!

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Carousel News & Announcements

What's New in the Community?

Check out the latest News & Events in the community!

Users online (2,779)