Forum Discussion

AbhishekIlindra's avatar
8 years ago

Custom Contact Me widget in the Profile Page

Hi,

 

Can we Customize the display of contact me widget in the Home page.

 

Ex: We would like to customize the display of "Date Last Visit" time stamp to different format.

 

Thanks,

Abhishek Illindra

  • Generally, if you want to change things like that for an out of the box component or widget, you'll have to manually re-build it. When you do that you have full control over any format you want.

     

    Some sample code:

    <#if !user.anonymous>
    	<#assign user_id = user.id/>	
    	<#attempt>
    		<#assign cust_date_format = settings.name.get("layout.format_pattern_date", "yyyy-MM-dd") />
    		<#assign cust_time_format = settings.name.get("layout.format_pattern_time", "HH:mm") />
    	<#recover>
    		<#assign cust_date_format = "yyyy-MM-dd"/>
    		<#assign cust_time_format = "HH:mm"/>
    	</#attempt>
    	<#assign query = rest("2.0", "/search?q=" + "SELECT last_visit_time FROM users WHERE id = '${user_id}'?url("UTF-8")).data.items[0] />
    	<#assign last_visit_time = query.last_visit_time!"N/A" />
    	Last visit time: ${last_visit_time}
    </#if>