Forum Discussion

Gursimrat's avatar
Gursimrat
Leader
11 years ago

Exception on the threads reply page - 'This widget could not be displayed'

I know this has been asked many times earlier, and I even tried the solutions in thread http://lithosphere.lithium.com/t5/developers-discussion/I-keep-getting-a-message-saying-This-widget-could-not-be/m-p/83520/highlight/true#M2949 in which I changed the rest call to restadmin calls, but it still did not work. My problem is similar to what others are getting,

 

Scenario:

 

When I reply to a thread with a user having Admin or Moderator role, it is fine, but when a user without any role replies to the thread, it shows 'This widget could not be displayed' on the "Replying to:" area which is below the rich text editor, as shown below:

 

------------------------------------------------------------------------------------------------------------------------------------------

Capture.PNG------------------------------------------------------------------------------------------------------------------------------------------

 

 

My code has many attemp recover blocks, code is as below:

 

<#include "*/pdc6_functions_shigton.ftl">
<#include "*/pdc6_functions.ftl">
<#assign messageId = env.context.message.id />
<#attempt>
<#assign threadId = page.context.thread.topicMessage.id />
<#recover>
<#assign threadId = -1 />
</#attempt>
<#attempt>
<#assign threadUId = page.context.thread.topicMessage.uniqueId />
<#recover>
<#assign threadUId = -1 />
</#attempt>
<#assign authorContext= env.context.message.author />
<#assign authorRest = rest("/users/id/${authorContext.id}")>
<#assign author = authorRest.user />
<#attempt>
    <#assign postCountRest = rest("/users/id/${author.id}/posts/count")>
<#recover>
   <#-- Cat. not there -->
</#attempt>
<#attempt>
    <#assign rolesRest = rest("/users/id/${author.id}/ranking")>
	
<#recover>
   <#-- Cat. not there -->
</#attempt>

<#attempt>
    
	<#assign onlineStatus = rest("/users/id/${author.id}/sessions/online/latest")>
<#recover>
   <#-- Cat. not there -->
</#attempt>


<#attempt>
    <#assign labelsRest = rest("/messages/id/${threadUId}/labels")>
<#recover>
   <#-- Cat. not there -->
</#attempt>
<#attempt>
    <#assign registrationDateRest = rest("/users/id/${author.id}/registration_time")>
<#recover>
   <#-- Cat. not there -->
</#attempt>
<#attempt>
    <#assign postDateRest = rest("/messages/id/${threadUId}/post_time")>
<#recover>
   <#-- Cat. not there -->
</#attempt>
<#attempt>
    <#assign rankIconRest = rest("/users/id/${author.id}/ranking/display/left_image")>
	
<#recover>
   <#-- Cat. not there -->
</#attempt>

<#attempt>
    
	<#assign rankIconRestRight = rest("/users/id/${author.id}/ranking/display/right_image")>
<#recover>
   <#-- Cat. not there -->
</#attempt>

<#attempt>
    <#assign rankImageRest = rest("/users/id/${author.id}/ranking/display/left_image")>
	
<#recover>
   <#-- Cat. not there -->
</#attempt>

<#attempt>
    
	<#assign rankImageRestRight = rest("/users/id/${author.id}/ranking/display/right_image")>
<#recover>
   <#-- Cat. not there -->
</#attempt>

<#assign postCount = postCountRest.value />

<#assign avatar = rest("/users/id/${author.id}/profiles/avatar/size/profile").image>

<#assign role = rolesRest.ranking.name />
<#if role == "N/A">
	<#assign role = "Member" />
</#if>
<#attempt>
<#assign labels = labelsRest.labels />
<#recover>

</#attempt>
<#assign registrationDateObject = registrationDateRest.value?datetime("yyyy-MM-dd'T'hh:mm:ss") />
<#assign registrationDateString = registrationDateObject?string("dd/MM/yyyy") />
<#attempt>
<#assign postDateObject = postDateRest.value?datetime("yyyy-MM-dd'T'hh:mm:ss") />
<#recover>

</#attempt>
<#assign isRegistered = onlineStatus.user_session.@null  />
<#if (isRegistered?has_content) >
<#assign registeredString = "Offline"/>
	<#assign registeredClass = "Offline" />

<#else>
	<#assign registeredString = "Online" />
	<#assign registeredClass = "Online" />
	
</#if>
<#if rankIconRest.image?has_content >
	
	<#assign rankIcon = rankIconRest.image.url />
	<#assign rankIconRight = rankIconRestRight.image.url />
<#else>	
	<#assign rankIcon = "no" />
</#if>

<#if messageId == threadId>
<div class="pdc6-author-details">
				<div class="top">
					<div class="date">
						<span class="day">${postDateObject?string('dd')}</span>
						<span class="month">${postDateObject?string('MMM')}</span>
						<span class="year">${postDateObject?string('YYYY')}</span>
					</div>
					<div class="avatar">
						<img width="100" height="100" src="${avatar.url}"  />
					</div>
					<div class="details" >
						<span class="name">By: <a href="/t5/user/viewprofilepage/user-id/${author.id}">${author.login}</a></span>
						<span class="role">
						<#if rankIcon?has_content >
							<img width="32" height="32" src="${rankIcon}" />
						</#if>
						${role}
						
							<#if rankIconRight?has_content >
							<img width="32" height="32" src="${rankIconRight}" />
						</#if>
						</span>
						
						
						<span class="post-count">${postCount} posts</span>
					</div>				
				</div>
				<div class="clear-both bottom">
					<div class="ranking">
						<div class="ranking-details">
							
							<div class="status ${registeredClass}">${registeredString}</div>
							<div class="addme"><a href="/t5/user/viewprofilepage/user-id/${author.id}">ADD AS A FRIEND</a></div>
						</div>
						<div class="ranking-icon">
							
						</div>
					</div>
					<ul class="labels">
                                                <li class="top">Labels</li>
						<#list labels.label as label>
                                                    <li><a href="/t5/forums/filteredbylabelpage/board-id/${page.context.thread.board.id}/label-name/${label.text}">${label.text}</a></li>
                                                </#list>
					</ul>
				</div>
				<div class="clear-both"></div>
			</div>

<#else>
<div class="pdc6-message-author-details">
	
	<div class="username">
		<#if rankIcon?has_content >
			<img width="32" height="32" src="${rankIcon}" />
		</#if>
	<a href="/t5/user/viewprofilepage/user-id/${author.id}">${author.login}</a>
	
	<#if rankIconRight?has_content >
			<img width="32" height="32" src="${rankIconRight}" />
	</#if>
	</div>
	
	
	
	<div class="role">${role}</div>
	
	<div class="avatar">
	    <img src="${avatar.url}" width="80" height="80" />
	</div>		
	
	<div class="inception"><strong>Member since</strong> ${registrationDateString}</div>
	
		<div class="status ${registeredClass}">${registeredString}</div>
		<div class="postcount"><strong>${postCount}</strong> posts</div>
	
	<div class="user-info"><a href="/t5/user/viewprofilepage/user-id/${author.id}">User Info</a></div>
	
	
    <div class="triangle">&nbsp;</div>
</div>
<div class="pdc6-message-author-details-hidden" style="display: none;">
	<div class="left-section">
		
		<div class="avatar">
			<img src="${avatar.url}" width="80" height="80"/>
		</div>	
<div class="username">
		<#if rankIcon?has_content >
			<img width="32" height="32" src="${rankIcon}" />
		</#if>
		<a href="/t5/user/viewprofilepage/user-id/${author.id}">${author.login}</a></div>		
		
		
	</div>
	<div class="right-section">
	    
		<div class="addme"><a href="/t5/user/viewprofilepage/user-id/${author.id}">ADD AS A FRIEND</a></div>
		
		
	</div>
</div>			
</#if>

 

 

Thanks

  • I even have rest permissions enabled for the users, is there some issue with the code?
    • premkumar's avatar
      premkumar
      Advisor

      Hi,

       

      I saw your code and noticed that you have used the rest call in many places. Some of the calls to specific URL might require Admin access so in those cases you can use restadmin instead of rest call.

       

      e.g restadmin("/users/id/${author.id}/ranking/display/right_image")

       

      Thanks,

      Premkumar

      • Gursimrat's avatar
        Gursimrat
        Leader

        premkumar  I tried it but it is still not working and is showing 'This widget could not be displayed' :(