Forums / Setup & design / How to extract active users from template

How to extract active users from template

Author Message

christian bencivenni

Wednesday 18 April 2007 1:14:28 am

Hi.
I have the need to extract in a template the list of active users (the users who complete the registration clicking on the email link).
I'm serching through documentation to finde something but it seems that there isn't anyway to extract this kind of information by a template fetch.
is it correct?
Any suggestions?

Egil Fujikawa Nes

Wednesday 18 April 2007 10:02:00 am

Hi Christian,

I needed a function like that for some time ago, what I ended up with were a loop trough the whole usergroup where my users are located (node 162). This is a bad way to write template code, but at that time I couldn't find any other possibilities.

My code looks like this:

{def $allusers=fetch( 'content', 'list', hash( 'parent_node_id', 162, 'depth', 1 ) )}
{section var=user loop=$allusers}		
     {if $user.object.data_map.user_account.content.is_enabled}			
         User enabled					
    {else}			
        User not enabled			
    {/if}			
{/section}

Hope this will help you :)

BuildCMS - Av. Paulista 777, 15° Andar - CEP: 01311-100 - São Paulo
URL: http://www.buildcms.com

christian bencivenni

Friday 20 April 2007 10:19:21 pm

It works perfectly.
Thank you a lot.