solved Displaying a users last logged in time

White Agency
White Agency
@white-agency
9 years ago
204 posts
Using the following code to display a users last logged in time when viewing their profile page but it only works for one user !
        {capture name="user_template" assign="logged_in_tpl"}
        	{literal}
        		{if isset($_items)}
        			{foreach from=$_items item="item"}
        				<p>{$item.user_last_login|jrCore_format_time}</p>
        			{/foreach}
        		{/if}
        	{/literal}
        {/capture}

         {jrCore_list module="jrUser" search1="user_id = $_profile_id" template=$logged_in_tpl no_cache=true}


updated by @white-agency: 08/12/15 08:11:10AM
paul
@paul
9 years ago
4,326 posts
search1="user_id = $_profile_id" is wrong.
'user_id' should be '_user_id' but that aside you are searching for when a user ID == a profile ID!!
Try search1="_profile_id = $_profile_id"


--
Paul Asher - JR Developer and System Import Specialist
White Agency
White Agency
@white-agency
9 years ago
204 posts
Thanks Paul :)

Knew it would be a simple mistake.
paul
@paul
9 years ago
4,326 posts
A simpler, and less resource hungry method might be this -

{$_this_user = jrCore_db_get_item_by_key('jrUser', '_profile_id', $_profile_id)}
<p>{$_this_user.user_last_login|jrCore_format_time}</p>



--
Paul Asher - JR Developer and System Import Specialist
White Agency
White Agency
@white-agency
9 years ago
204 posts
You are a star :)

Tags