Shivshankar
7 years agoAce
This widget could not be displayed.
I have a piece of code in custom widget.
<#if !user.anonymous> <#assign userLanguage=restadmin("/users/id/${user.id?c}/profiles/name/language").value /> <#assign loginStatus="Yes"> <#assign userRank=restadmin('users/id/${user.id?c}/ranking').ranking.name /> <#assign userRolesRequest=restadmin('users/id/${user.id?c}/roles') /> <#if userRolesRequest.roles?? && userRolesRequest.roles?has_content> <#list userRolesRequest.roles.role as r> <#assign userRole+= r.name+":"/> </#list> <#assign userRole=userRole?substring(0,userRole?length-1)/> </#if> </#if>
When user is not logged in(anonymous) or admin this is not giving any issue.
But for Non admin users this is showing "widget could not be displayed".
I have put down all condition checks still error is there , what might be the reason and i am unable to figure out where if i am missing something.
Please suggest.
Shivshankar - One of the issues is on the line number 8.
wrote:<#assign userRole+= r.name+":"/>
Freemarker doesn't support concatenating variable like JS. (userRole+=)
Please update 8th line as below.
<#assign userRole= userRole + r.name+":"/>