We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10152
    • 156 Posts
    Hi! I would like to retrieve only the members that belong to the "competitors" usergroup... All what I can do is fetch all the users with
    $users      = $modx->getCollection('modUser', array ('active' => '1'));
    

    is there a solution for this?

    Thanks
      • 3749
      • 24,544 Posts
      I think this might do it. Some of it may be unnecessary for your purposes and there may be an easier way.

      <?php
      $sort = $modx->getOption('sort',$_REQUEST,'username');
      $dir = $modx->getOption('dir',$_REQUEST,'ASC');
      $usergroup =  3 // I think this should be the ID of the user group rather than the name, but I'm not sure.
      
      /* build query */
      $c = $modx->newQuery('modUser');
      $c->innerJoin('modUserGroupMember','UserGroupMembers');
      $c->innerJoin('modUserGroup','UserGroup','UserGroupMembers.user_group = UserGroup.id');
      $c->leftJoin('modUserGroupRole','UserGroupRole','UserGroupMembers.role = UserGroupRole.id');
      $c->where(array(
          'UserGroupMembers.user_group' => $usergroup,
      ));
      
      $count = $modx->getCount('modUser',$c);
      
      $c->select('
          `modUser`.*,
          `UserGroup`.`id` AS `usergroup`,
          `UserGroup`.`name` AS `usergroup_name`,
          `UserGroupRole`.`name` AS `role`,
          `UserGroupRole`.`name` AS `role_name`
      ');
      $c->sortby($sort,$dir);
      
      $users = $modx->getCollection('modUser',$c);
      ?>
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 10152
        • 156 Posts
        Thanks a lot BobRay, this is an useful example. I went on your site and saw the "modUserGroupRole" thing but didnt get how to use. It’s clearer now
          • 3749
          • 24,544 Posts
          Great. Maybe you can explain it to me. tongue

          I just borrowed the code from the Manager and simplified it a little.

          On second thought, if all you want is the IDs of the users in the group, it should be much simpler, especially if you don’t need the roles. Everything you need should be in the modx_member_groups table, but I’m too tired to work it out.






            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 10152
            • 156 Posts
            In fact I need more than just the ids of the users, so the complete profile is perfect.

            I’ve replaced my single line query by the whole example you gave me and just changed the usergroup value and added ’active’=>1 in the where clause and it goes like clockwork. The id no needs to be changed by a string. Good idea for looking at the manager code, I did not think at this.

              • 3749
              • 24,544 Posts
              And it worked? This must be my lucky day. wink

              Can you share the code for producing the user information? I’m sure others will find it useful.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 10152
                • 156 Posts
                Well it was my lucky day too wink
                Yes here it, at draft status. Surelly many things won’t be following the rules of modx and the coding level is not wonderful.

                With this snippet you can
                -edit your own profile
                -list profiles with pagination
                -view a single profile (not fully implemented)

                I’ll post when fully-working with the templates related to. And when clean with coding standards wink

                <?php
                
                    // regler le .htaccess pour l'url rewriting sinon 404
                
                
                    $getUsr     = addslashes($_GET['usr']);
                    $competitorsgroup  =  5;
                
                    $dateFormat     = $modx->getOption('date_format');   // context setting : 'Y-m-d' = english format  'd-m-Y' = french format
                    $dateFormatLong = $modx->getOption('date_format_long');
                
                
                    if ( $service == 'form' ) {
                
                        if ( !empty ( $_POST ) ) {
                
                            $email              = $_POST['email'];
                            $phone              = $_POST['phone'];
                            $mobilephone        = $_POST['mobilephone'];
                            $fullname           = $_POST['fullname'];
                            $firstname          = $_POST['firstname'];
                            $dob                = $_POST['dob'];
                            $gender             = (int)$_POST['gender'];
                            $country            = $_POST['country'];
                            $city               = $_POST['city'];
                            $state              = $_POST['state'];
                            $zip                = $_POST['zip'];
                            $fax                = $_POST['fax'];
                            $photo              = $_POST['photo'];
                            $comment            = $_POST['comment'];
                
                
                
                            $profile = $modx->user->getOne('Profile');
                
                
                            if($email!='' ) {
                                if(preg_match("#^[a-z0-9][-a-z0-9.]*@[-a-z0-9]+\.[-a-z0-9_.]+$#i", $email)) {
                                    $profile->set('email',$email);
                                }
                                else {
                                    $error .= '[[%language.email]]';
                                }
                            }
                            if($phone!='' ) {
                
                                $phone = ereg_replace("[^0-9]","",$phone);
                
                                if(preg_match("`^0[1-68][0-9]{8}$`", $phone)) {
                                    $profile->set('phone',$phone);
                                }
                                else {
                                    $error .= '[[%language.phone]]';
                                }
                            }
                            if($mobilephone!='' ) {
                
                                $mobilephone = ereg_replace("[^0-9]","",$mobilephone);
                
                                if(preg_match("`^0[1-68][0-9]{8}$`", $mobilephone)) {
                                    $profile->set('mobilephone',$mobilephone);
                                }
                                else {
                                    $error .= '[[%language.mobilephone]]';
                                }
                            }
                            if($fax!='' ) {
                
                                $fax = ereg_replace("[^0-9]","",$fax);
                
                                if(preg_match("`^0[1-68][0-9]{8}$`", $fax)) {
                                    $profile->set('fax',$fax);
                                }
                                else {
                                    $error .= '[[%language.fax]]';
                                }
                            }
                            if ( $fullname!='' || $firstname!='') {
                                $profile->set('fullname',$fullname.'|'.$firstname);
                            }
                
                            if ( $dob!='' ) {
                // works with french date format only d-m-Y not Y-m-d
                                $day = substr($dob,0,2);
                                $month = substr($dob,3,2);
                                $year = substr($dob,6,4);
                
                                if ( $day>0 && $day<=31 && $month>0 && $month<=12 && $year>(date('Y')-100) && $year<( date('Y')-18 ) ) {
                
                                    $profile->set('dob',mktime(0,0,0,(int)$month, (int)$day, (int) $year));
                
                                }
                                else {
                
                                    $error .= '[[%language.dob]]';
                
                                }
                
                            }
                
                            if ( $gender!=0 ) {
                                if ( $gender==1 || $gender==2 || $gender==3 ) {
                                    $profile->set('gender',($gender-1));
                                }
                                else {
                                    $error .= '[[%language.gender]]';
                                }
                            }
                
                            if ( $country!='' || $city!='') {
                                $profile->set('country',$country.'|'.$city);
                            }
                
                            if($state!='') {  // ... && in_array ($state, 'france','suisse','pays autorisés');
                                $profile->set('state',$state);
                            }
                            else {
                                $error .= '[[%language.state]]';
                            }
                
                            if($zip!='' ) {
                                $profile->set('zip',strlen($zip,20));
                            }
                
                            if( $photo != '' ) {
                                $profile->set('photo',$photo);
                            }
                            if( $comment != '' ) {
                                $profile->set('comment',substr($comment,0,255));
                            }
                
                
                            $profile->save();
                
                            if ( $error != '' ) {
                
                                $output = '<p class="error">'.$error.'</p>';
                
                            }
                            else {
                
                                $output = '<p class="message">[[%language.ok]]</p>';
                
                            }
                
                        }
                
                    }
                    if ( $service=='form') {
                
                        $user           = $modx->user;
                        $profile        = $user->getOne('Profile');
                
                        $email          = $profile->get('email');
                        $phone          = $profile->get('phone');
                        $mobilephone    = $profile->get('mobilephone');
                        $completename   = explode('|',$profile->get('fullname'));
                        $fullname       = $completename [0];
                        $firstname      = $completename [1];
                        $dob            = $profile->get('dob');
                        $gender         = $profile->get('gender');
                        $state          = $profile->get('state');
                        $completeplace  = explode('|',$profile->get('country'));
                        $country        = $completeplace [0];
                        $city           = $completeplace [1];
                        $zip            = $profile->get('zip');
                        $fax            = $profile->get('fax');
                        $photo          = $profile->get('photo');
                        $comment        = $profile->get('comment');
                
                
                        $i=0;
                        foreach ($states as $staterow) {
                
                
                
                            if ( (int)$state == $i ) {
                
                                $selectedstate[$i]   = ' selected="selected" ';
                
                            }
                
                            $i++;
                
                        }
                
                
                        if ( $gender == 2 ) {
                            $selectedfemale = ' selected="selected" ';
                        }
                        if ( $gender == 1 ) {
                            $selectedmale   = ' selected="selected" ';
                        }
                        if ( $gender == 2 ) {
                            $selectedfemale = ' selected="selected" ';
                        }
                        if ( $dob != '' ) {
                            $convertedDob = date($dateFormat, $dob);
                        }
                        $output .= '<form action="[[++site_url]][[~32]]" method="post" name="entryForm" autocomplete="on" accept-charset="[[++modx_charset]]" enctype="multipart/form-data">
                        <fieldset>
                        <legend>[[%language.coords]]</legend>
                                <label for="email"><span class="padLeft">[[%language.email]]</span><span> → </span>
                                <input id="email" name= "email" type="text" value="'.$email.'" /></label>
                                <label for="phone"><span class="padLeft">[[%language.phone]]</span><span> → </span>
                                <input id="phone" name= "phone" type="text" value="'.$phone.'" /></label>
                                <label for="mobilephone"><span class="padLeft">[[%language.mobilephone]]</span><span> → </span>
                                <input id="mobilephone" name= "mobilephone" type="text" value="'.$mobilephone.'" /></label>
                                <label for="fax"><span class="padLeft">[[%language.fax]]</span><span> → </span>
                                <input id="fax" name= "fax" type="text" value="'.$fax.'" /></label>
                        <legend>[[%language.personal_infos]]</legend>
                                <label for="fullname"><span class="padLeft">[[%language.name]]</span><span> → </span>
                                <input id="fullname" name= "fullname" type="text" value="'.$fullname.'" /></label>
                                <label for="firstname"><span class="padLeft">[[%language.firstname]]</span><span> → </span>
                                <input id="firstname" name= "firstname" type="text" value="'.$firstname.'" /></label>
                                <label for="dob"><span class="padLeft">[[%language.dob]] <small>[[%language.dob_format]]</small></span><span> → </span>
                                <input id="dob" name= "dob" type="text" value="'.$convertedDob.'" /></label>
                
                                <label for="gender"><span class="padLeft">[[%language.gender]]</span><span> → </span>
                                <select name="gender">
                                <optgroup label="[[%language.please_choose]]">
                                  <option value="1">[[%language.undefined]]</option>
                                  <option value="2" '.$selectedmale.'>[[%language.male]]</option>
                                  <option value="3" '.$selectedfemale.'>[[%language.female]]</option>
                                  </optgroup>
                                </select>
                                </label>
                
                                <legend>[[%language.localisation]]</legend>
                
                                <label for="state"><span class="padLeft">[[%language.state]]</span><span> → </span>
                                <select name="state">
                                <optgroup label="[[%language.please_choose]]">
                                  <option value="">[[%language.undefined]]</option>';
                
                
                                $i=0;
                                foreach ($states as $staterow) {
                
                                    $output.='<option value="'.(int)$i.'" '.$selectedstate[$i].'>[[%language.'.strtolower($staterow).']]</option>';
                                    $i++;
                
                                }
                
                
                               $output .=  '</optgroup>
                                </select>
                                </label>
                
                                <label for="country"><span class="padLeft">[[%language.country]]</span><span> → </span>
                                <input id="country" name= "country" type="text" value="'.$country.'" /></label>
                
                                <label for="city"><span class="padLeft">[[%language.city]]</span><span> → </span>
                                <input id="city" name= "city" type="text" value="'.$city.'" /></label>
                
                                <!--HTML5 input id="gender" name="gender" list="mylistgender" type="text">
                                <datalist id="mylistgender">
                                    <option label="homme" value="'.$gender.'" selected />
                                    <option label="homme" value="homme" />
                                    <option label="femme" value="femme" />
                                </datalist>
                                <legend>[[%language.localisation]]</legend>
                                <label for="state"><span class="padLeft">[[%language.state]]</span><span> → </span>
                                <input id="state" name="state" list="myliststate" type="text">
                                <datalist id="myliststate">
                                    <option label="allemagne" value="allemagne" />
                                    <option label="france" value="france" />
                                    <option label="suisse" value="suisse" />
                                </datalist>
                                <label for="country"><span class="padLeft">[[%language.country]]</span><span> → </span>
                                <input id="country" name="country" list="mylistcountry" type="text">
                                <datalist id="mylistcountry">
                                    <option label="basel" value="basel" />
                                    <option label="colmar" value="colmar" />
                                    <option label="mulhouse" value="mulhouse" />
                                </datalist>
                                <label for="zip"><span class="padLeft">[[%language.zip]]</span><span> → </span>
                                <input id="zip" name="zip" list="mylistzip" type="text">
                                <datalist id="mylistzip">
                                    <option label="68000" value="68000" />
                                    <option label="68100" value="68100" />
                                </datalist-->
                
                
                                <label for="comment"><span class="padLeft">[[%language.comment]]</span><span> → </span>
                                <textarea id="comment" name="comment">'.$comment.'</textarea>
                
                                 <button type="submit" name="newEntryBtn" value="Modifier mon profil">☛ Modifier mon profil</button>
                        </fieldset>
                    </form>';
                
                
                    }
                
                        if ( $service =='viewprofiles' || $service =='viewprofile' ) {
                
                
                        /*
                        $email          = $profile->get('email');
                        $phone          = $profile->get('phone');
                        $mobilephone    = $profile->get('mobilephone');
                        $completename   = explode('|',$profile->get('fullname'));
                        $fullname       = $completename [0];
                        $firstname      = $completename [1];
                        $dob            = $profile->get('dob');
                        $gender         = $profile->get('gender');
                        $state          = $profile->get('state');
                        $completeplace  = explode('|',$profile->get('country'));
                        $country        = $completeplace [0];
                        $city           = $completeplace [1];
                        $zip            = $profile->get('zip');
                        $fax            = $profile->get('fax');
                        $photo          = $profile->get('photo');
                        $comment        = $profile->get('comment');
                        */
                
                
                
                        $limit          = 5;
                        $curPage        = (int)$_GET['page'];
                        $rel            ='rel="nofollow,noindex"';
                        $currentClass   = 'current';
                        $output         = '';
                
                        if ( $curPage==0) {
                
                            $curPage++;
                
                        }
                
                        if ( $service =='viewprofiles') {
                
                
                            $sort       = $modx->getOption('sort',$_REQUEST,'username');
                            $dir        = $modx->getOption('dir',$_REQUEST,'ASC');
                
                
                            /* build query */
                            $c = $modx->newQuery('modUser');
                            $c->innerJoin('modUserGroupMember','UserGroupMembers');
                            $c->innerJoin('modUserGroup','UserGroup','UserGroupMembers.user_group = UserGroup.id');
                            $c->leftJoin('modUserGroupRole','UserGroupRole','UserGroupMembers.role = UserGroupRole.id');
                            $c->where(array(
                                'UserGroupMembers.user_group' => $competitorsgroup,
                                'active' => '1',
                            ));
                
                            $count = $modx->getCount('modUser',$c);
                
                            $c->select('
                                `modUser`.*,
                                `UserGroup`.`id` AS `usergroup`,
                                `UserGroup`.`name` AS `usergroup_name`,
                                `UserGroupRole`.`name` AS `role`,
                                `UserGroupRole`.`name` AS `role_name`
                            ');
                            $c->sortby($sort,$dir);
                
                            $users = $modx->getCollection('modUser',$c);
                
                
                
                
                
                
                        }
                        elseif ( $service == 'viewprofile' ) {
                
                            $users      = $modx->getCollection('modUser',array('username'=>$getUsr));
                
                        }
                
                
                
                
                        $sortie = array();
                
                        foreach ( $users as $user ) {
                
                            $i++;
                
                
                            $username       = '';
                            $fullname       = '';
                            $firstname      = '';
                            $lastname       = '';
                            $dob            = '';
                            $blocked_until  = '';
                            $blocked_after  = '';
                            $last_login     = '';
                            $blocked        = '';
                            $gender         = '';
                            $country        = '';
                            $state          = '';
                            $zip            = '';
                            $photo          = '';
                
                            if ( $i> ( $curPage-1 ) * $limit && $i <= $curPage * $limit ) {
                
                
                                $properties             = $user->toArray();
                
                                $profile                = $user->getOne('Profile');
                
                
                
                                $sortie[] = $modx->getChunk('tplProfiles', $properties);
                
                
                
                
                                // Username
                                $modx->setPlaceholders(array(
                                        'user' => $user->get('username'),)
                                        ,'profile.');
                
                                // Fullname
                                $completename   = explode('||',$profile->get('fullname'));
                                $lastname       = $completename [0];
                                $firstname      = $completename [1];
                
                
                                $modx->setPlaceholders(array(
                                    'lastname' => $lastname,)
                                    ,'profile.');
                
                
                                $modx->setPlaceholders(array(
                                    'firstname' => $firstname,)
                                    ,'profile.');
                
                
                
                                // E-mail
                                if ( $profile->get('email') != '' ) {
                
                                    $email = $profile->get('email');
                                    $modx->setPlaceholders(array(
                                            'email' => $email,)
                                            ,'profile.');
                                }
                                else {
                
                                    $modx->setPlaceholders(array(
                                            'email' => '',)
                                            ,'profile.');
                
                                }
                
                                // E-mail
                                if ( $profile->get('phone') != '' ) {
                
                                    $phone = $profile->get('phone');
                                    $modx->setPlaceholders(array(
                                            'phone' => $phone,)
                                            ,'profile.');
                                }
                                else {
                
                                    $modx->setPlaceholders(array(
                                            'phone' => '',)
                                            ,'profile.');
                
                                }
                
                                // E-mail
                                if ( $profile->get('mobilephone') != '' ) {
                
                                    $mobilephone = $profile->get('mobilephone');
                                    $modx->setPlaceholders(array(
                                            'mobilephone' => $mobilephone,)
                                            ,'profile.');
                                }
                                else {
                
                                    $modx->setPlaceholders(array(
                                            'mobilephone' => '',)
                                            ,'profile.');
                
                                }
                
                                // E-mail
                                if ( $profile->get('fax') != '' ) {
                
                                    $fax = $profile->get('fax');
                                    $modx->setPlaceholders(array(
                                            'fax' => $fax,)
                                            ,'profile.');
                                }
                                else {
                
                                    $modx->setPlaceholders(array(
                                            'fax' => '',)
                                            ,'profile.');
                
                                }
                
                                // E-mail
                                if ( $profile->get('address') != '' ) {
                
                                    $address = $profile->get('address');
                                    $modx->setPlaceholders(array(
                                            'address' => $address,)
                                            ,'profile.');
                                }
                                else {
                
                                    $modx->setPlaceholders(array(
                                            'address' => '',)
                                            ,'profile.');
                
                                }
                
                
                
                                // Blocked or not
                                if ( ( int )  $profile->get('blocked') !=  0 ) {
                
                
                                    $blocked = '[[%blocked]]';
                
                                }
                                else {
                
                                    $blocked = '[[%not_blocked]]';
                
                                }
                
                                $modx->setPlaceholders(array(
                                        'blocked' => $blocked,)
                                        ,'profile.');
                
                
                                // Blocked until
                                $blocked_until =$profile->get('blockeduntil');
                
                                $modx->setPlaceholders(array(
                                            'blocked_until' => date($dateFormat, $blocked_until),)
                                            ,'profile.');
                
                                // Blocked after
                                $blocked_after =$profile->get('blockedafter');
                
                                $modx->setPlaceholders(array(
                                            'blocked_after' => date($dateFormat, $blocked_after),)
                                            ,'profile.');
                
                
                                // Last login
                
                                //comment
                                if ( $profile->get('lastlogin') != '' ) {
                
                                    $modx->setPlaceholders(array(
                                            'last_login' => date($dateFormatLong, $profile->get('lastlogin')),)
                                            ,'profile.');
                                }
                                else {
                                    $modx->setPlaceholders(array(
                                            'last_login' => '',)
                                            ,'profile.');
                                }
                
                
                
                                // Date of birth
                                if ( $profile->get('dob') != '' ) {
                
                                    $dob = $profile->get('dob');
                
                                }
                                else {
                
                                    $modx->setPlaceholders(array(
                                            'dob' => '',)
                                            ,'profile.');
                
                                }
                                $modx->setPlaceholders(array(
                                            'dob' => date($dateFormat,$dob),)
                                            ,'profile.');
                
                                // Gender
                                if ( ( int ) $profile->get('gender') == 1 ) {
                
                
                                    $gender = '[[$male1]]';
                
                                }
                                else if ( ( int ) $profile->get('gender') == 2 ) {
                
                                    $gender = '[[$female1]]';
                
                                }
                                else {
                
                                    $gender = '';
                
                                }
                
                
                                $modx->setPlaceholders(array(
                                        'gender' => $gender,)
                                        ,'profile.');
                
                
                                if ( $profile->get('country') != '' ) {
                
                                    $modx->setPlaceholders(array(
                                            'country' => $profile->get('country'),)
                                            ,'profile.');
                                }
                                else {
                
                                    $modx->setPlaceholders(array(
                                            'country' => '',)
                                            ,'profile.');
                
                                }
                
                                //state
                                if ( $profile->get('state') != '' ) {
                
                                    $modx->setPlaceholders(array(
                                            'state' => $profile->get('state'),)
                                            ,'profile.');
                                }
                                else {
                
                                    $modx->setPlaceholders(array(
                                            'state' => '',)
                                            ,'profile.');
                
                                }
                
                
                                //city
                                if ( $profile->get('city') != '' ) {
                
                                    $modx->setPlaceholders(array(
                                            'city' => $profile->get('city'),)
                                            ,'profile.');
                                }
                                else {
                
                                    $modx->setPlaceholders(array(
                                            'city' => '',)
                                            ,'profile.');
                
                                }
                
                                //zip
                                if ( $profile->get('zip') != '' ) {
                
                                    $modx->setPlaceholders(array(
                                            'zip' => $profile->get('zip'),)
                                            ,'profile.');
                                }
                                else {
                
                                    $modx->setPlaceholders(array(
                                            'zip' => '',)
                                            ,'profile.');
                
                                }
                
                
                                //photo
                                if ( $profile->get('photo') != '' ) {
                
                                    $modx->setPlaceholders(array(
                                            'photo' => $profile->get('photo'),)
                                            ,'profile.');
                                }
                                else {
                                    $modx->setPlaceholders(array(
                                            'photo' => '',)
                                            ,'profile.');
                                }
                
                
                                //comment
                                if ( $profile->get('comment') != '' ) {
                
                                    $modx->setPlaceholders(array(
                                            'comment' => $profile->get('comment'),)
                                            ,'profile.');
                                }
                                else {
                                    $modx->setPlaceholders(array(
                                            'comment' => '',)
                                            ,'profile.');
                                }
                
                
                
                            }
                
                        }
                        $output.=implode("\n", $sortie);
                
                        $output = '<ul>'.$output.'</ul>';
                
                        /*
                
                        Pagination
                
                        */
                        if ( $service =='viewprofiles') {
                
                            $pagination.=  '<nav class="paging"><ul>';
                
                            $total_pages = $i / $limit;
                
                            if ( $curPage > 1 ) {
                
                                $pagination .= '<li><a href="[[++site_url]][[~[[*id]]]]page-'.($curPage-1).'/" class="page" '.$rel.'>[[%previous]]</a></li>'."\n";
                
                            }
                
                
                
                
                            while ($j <= $total_pages ) {
                
                                $j++;
                
                                if ( $j == $curPage ) {
                
                                    $curClass = $currentClass;
                
                                }
                
                
                                $pagination .= '<li><a href="[[++site_url]][[~[[*id]]]]page-'.$j.'/" class="pager '.$curClass.'" '.$rel.'>'.$j.'</a></li>'."\n";
                
                            }
                
                            if ( $curPage < $total_pages ) {
                
                                $pagination .= '<li><a href="[[++site_url]][[~[[*id]]]]page-'.($curPage+1).'/" class="pager" '.$rel.'>[[%next]]</a></li>'."\n";
                
                            }
                
                
                            $pagination .= '</ul></nav>';
                
                        }
                
                    }
                
                
                    echo $output.$pagination;
                ?>
                


                Now the template for profiles (tplProfiles):
                <li class="profile">
                	<ul>       
                		<li><a href="[[++site_url]][[~[[++page_user_profile]]]]?usr=[[+profile.user]]"><strong>[[+profile.user]]</strong>
                [[!If? &operator=`NEQ` &operand=`` &subject=`[[+profile.gender]]` &then=`<li>[[+profile.gender]]</li>`]]
                
                </a></li>
                		<li>[[+profile.blocked]]</li>
                
                
                
                		[[!If? &operator=`NEQ` &operand=`` &subject=`[[+profile.lastname]]` &then=`<li><span>[[%lastname]]</span>[[$arrow1]][[+profile.lastname]]</li>`]]
                
                		[[!If? &operator=`NEQ` &operand=`` &subject=`[[+profile.firstname]]` &then=`<li><span>[[%firstname]]</span>[[$arrow1]][[+profile.firstname]]</li>`]]
                
                		[[!If? &operator=`NEQ` &operand=`` &subject=`[[+profile.email]]` &then=`<li><span>[[%email]]</span>[[$arrow1]][[+profile.email]]</li>`]]
                
                
                		[[!If? &operator=`NEQ` &operand=`` &subject=`[[+profile.phone]]` &then=`<li><span>[[%phone]]</span>[[$arrow1]][[+profile.phone]]</li>`]]
                
                
                		[[!If? &operator=`NEQ` &operand=`` &subject=`[[+profile.mobilephone]]` &then=`<li><span>[[%mobilephone]]</span>[[$arrow1]][[+profile.mobilephone]]</li>`]]
                
                
                		[[!If? &operator=`NEQ` &operand=`` &subject=`[[+profile.fax]]` &then=`<li><span>[[%fax]]</span>[[$arrow1]][[+profile.fax]]</li>`]]
                
                
                		[[!If? &operator=`NEQ` &operand=`` &subject=`[[+profile.address]]` &then=`<li><span>[[%address]]</span>[[$arrow1]][[+profile.address]]</li>`]]
                
                		[[!If? &operator=`NEQ` &operand=`` &subject=`[[+profile.dob]]` &then=`<li><span>[[%dob]]</span>[[$arrow1]][[+profile.dob]]</li>`]]
                
                		[[!If? &operator=`NEQ` &operand=`` &subject=`[[+profile.country]]` &then=`<li><span>[[%country]]</span>[[$arrow1]][[+profile.country]]</li>`]]
                
                		[[!If? &operator=`NEQ` &operand=`` &subject=`[[+profile.state]]` &then=`<li><span>[[%state]]</span>[[$arrow1]][[+profile.state]]</li>`]]
                
                		[[!If? &operator=`NEQ` &operand=`` &subject=`[[+profile.city]]` &then=`<li><span>[[%city]]</span>[[$arrow1]][[+profile.city]]</li>`]]
                
                		[[!If? &operator=`NEQ` &operand=`` &subject=`[[+profile.zip]]` &then=`<li><span>[[%zip]]</span>[[$arrow1]][[+profile.zip]]</li>`]]
                
                		[[!If? &operator=`NEQ` &operand=`` &subject=`[[+profile.photo]]` &then=`<li><span>[[%photo]]</span>[[$arrow1]][[+profile.photo]]</li>`]]
                
                		[[!If? &operator=`NEQ` &operand=`` &subject=`[[+profile.comment]]` &then=`<li><span>[[%comment]]</span>[[$arrow1]][[+profile.comment]]</li>`]]
                
                
                
                		[[!If? &operator=`NEQ` &operand=`` &subject=`[[+profile.blocked_until]]` &then=`<li><span>[[%blocked_until]]</span>[[$arrow1]][[+profile.blocked_until]]</li>`]]
                
                		[[!If? &operator=`NEQ` &operand=`` &subject=`[[+profile.blocked_after]]` &then=`<li><span>[[%blocked_after]]</span>[[$arrow1]][[+profile.blocked_after]]</li>`]]
                
                		[[!If? &operator=`NEQ` &operand=`` &subject=`[[+profile.last_login]]` &then=`<li><span>[[%last_login]]</span>[[$arrow1]][[+profile.last_login]]</li>`]]
                
                
                	</ul>
                </li>