static function usersList(&$row, &$users, &$columns, &$allFields, &$lists, $listid, $search, $searchmode, $option_itemid, $limitstart, $limit, $total, &$myUser, &$searchableFields, &$searchVals, &$tabs, $list_compare_types, $showPaging, $hotlink_protection, $errorMsg, $random)
    {
        global $_CB_framework, $ueConfig, $_PLUGINS, $_POST, $_GET, $_REQUEST;
        $results = $_PLUGINS->trigger('onBeforeDisplayUsersList', array(&$row, &$users, &$columns, &$allFields, &$lists, $listid, &$search, &$option_itemid, 1));
        // $uid = 1
        $cbTemplate = HTML_comprofiler::_cbTemplateLoad();
        // regroup parts of the different plugins:
        $pluginAdditions = array('search', 'header', 'footer');
        $pluginAdditions['search'] = array();
        $pluginAdditions['header'] = array();
        $pluginAdditions['footer'] = array();
        if (is_array($results) && count($results) > 0) {
            foreach ($results as $res) {
                if (is_array($res)) {
                    foreach ($res as $k => $v) {
                        $pluginAdditions[$k][] = $v;
                    }
                }
            }
        }
        $listTitleHtml = cbReplaceVars(getLangDefinition($row->title), $myUser);
        $listTitleNoHtml = strip_tags(cbReplaceVars(getLangDefinition($row->title), $myUser, false, false));
        $listDescription = cbReplaceVars(getLangDefinition($row->description), $myUser);
        $_CB_framework->setPageTitle($listTitleNoHtml);
        $_CB_framework->appendPathWay($listTitleHtml);
        $cbSpoofField = cbSpoofField();
        $cbSpoofString = cbSpoofString(null, 'usersList');
        if ($hotlink_protection == 1) {
            $spoofAmp = "&" . $cbSpoofField . '=' . urlencode($cbSpoofString);
        } else {
            $spoofAmp = null;
        }
        // Base URL string:
        $ue_base_url = 'index.php?option=com_comprofiler&task=usersList&listid=' . (int) $listid . '&Itemid=' . (int) $option_itemid;
        $ue_base_url_non_sef = $_CB_framework->getCfg('live_site') . '/' . $ue_base_url;
        // $adminimagesdir			=	"components/com_comprofiler/images/";
        $searchTabContent = $tabs->getSearchablesContents($searchableFields, $myUser, $searchVals, $list_compare_types);
        // table content:
        $tableContent =& HTML_comprofiler::_getListTableContent($users, $columns, $allFields);
        outputCbTemplate(1);
        //no need for now:	initToolTip(1);
        // paginator addition:
        $pagingSearch = '';
        foreach (get_object_vars($searchVals) as $k => $v) {
            if (is_array($v)) {
                $pArr = '&' . urlencode($k);
                foreach ($v as $kk => $vv) {
                    $pagingSearch .= $pArr . '[' . urlencode($kk) . ']=' . urlencode($vv);
                }
            } else {
                $pagingSearch .= '&' . urlencode($k) . '=' . urlencode($v);
            }
        }
        if ($random) {
            $pagingSearch .= '&rand=' . (int) $random;
        }
        //	Add Javascript to click tr:
        $jsClickTr = " {" . "\n\t\tvar cbUserURLs = new Array(";
        if (is_array($users) && $ueConfig['allow_profilelink'] == 1) {
            foreach ($users as $user) {
                $jsClickTr .= "'" . cbSef('index.php?option=com_comprofiler&task=userProfile&user='******',";
            }
        }
        $jsClickTr .= "'');" . "\n\t\t\$('#cbUserTable > tbody > tr').click( function(e) {" . "\n\t\t\tif ( ! ( \$(e.target).is('a') || ( \$(e.target).is('img') && \$(e.target).parent().is('a') ) || \$(e.target).hasClass('cbClicksInside') || ( \$(e.target).parents('.cbClicksInside').length > 0 ) || ( \$(this).attr('id') == '' ) ) ) {" . ($ueConfig['allow_profilelink'] == 1 ? "\n\t\t\t\twindow.location = cbUserURLs[this.id.substr(3)];" : '') . "\n\t\t\t\treturn false;" . "\n\t\t\t}" . "\n\t\t} );" . "\n\t}";
        $_CB_framework->outputCbJQuery($jsClickTr);
        /*
        								//	Add Javascript to pagination of list
        		$jsPagination			=	"	$('#cbUserList a.pagenav').click( function() {"
        								//	Get the href of the pagination link:
        								.	"\n		var href = $(this).attr('href');"
        								//	Get the page limitstart value:
        								.	"\n		var matches = /limitstart=(\\d*)/.exec(href);"
        								.	"\n		if ( matches && matches.length == 2 ) {"
        								//	Set limitstart input:
        								.	"\n			$('input#cbListlimitstart').val( matches[1] );"
        								//	Submit the form, so the values are taken:
        								.	"\n			$('form#adminForm').submit();"
        								//	And avoid the <a> link being followed:
        								.	"\n			return false;"
        								.	"\n		}"
        								//	Link doesn't match, simply follow link:
        								.	"\n		return true;"
        								.	"\n	} );"
        								;
        
        		$_CB_framework->outputCbJQuery( $jsPagination );
        */
        if (count($searchableFields) > 0) {
            cbUsersList::outputAdvancedSearchJs($search);
        }
        // list title:
        ?>
<div class="cbUsersList"><div id="cbUsersListInner">
<?php 
        if ($errorMsg) {
            echo '<div class="error">' . $errorMsg . '</div>';
        }
        ?>

  <form class="cb_form" name="adminForm" id="adminForm" method="get" action="<?php 
        echo $ue_base_url_non_sef . "&amp;action=search";
        // on purpose without SEF, as joomla 1.0/mambo 4.5.5 core sef doesn't work with this.
        ?>
" >
    <input type="hidden" name="option" value="com_comprofiler" />
    <input type="hidden" name="task" value="usersList" />
    <input type="hidden" name="Itemid" value="<?php 
        echo $option_itemid;
        ?>
" />
    <input type="hidden" name="limitstart" id="cbListlimitstart" value="0" />
    <input type="hidden" name="search" value="" />
  <?php 
        /* old method, replaced by hidden search field above:
        			<div class="cbUserListSearchBox">
        			  <div>
        				<input type="text" name="search" class="inputbox" size="15" maxlength="100" value="<?php echo htmlspecialchars( $search ); ?>" />
        				<input type="image" src="<?php echo $adminimagesdir; ?>search.gif" alt="<?php echo _UE_SEARCH; ?>" align="top" style="border: 0px;" />
        			  </div>
        			  
        			</div>
        			<div class="cbClr"></div>
        */
        echo cbGetSpoofInputTag(null, $cbSpoofString);
        // Render search-area header:
        if (count($pluginAdditions['search'])) {
            $searchTabContent .= '<div class="cbClr"></div><div id="cbUserListSearchPlugins"><div>' . implode('</div><div>', $pluginAdditions['search']) . '</div></div>';
        }
        $totalIsAllUsers = !($search !== null || $row->filterfields != '');
        $searchResultDisplaying = $search !== null;
        $searchCriteriaTitleHtml = cbReplaceVars(_UE_SEARCH_CRITERIA, $myUser);
        if ($searchmode == 0) {
            $searchResultsTitleHtml = cbReplaceVars(_UE_SEARCH_RESULTS, $myUser);
        } else {
            $searchResultsTitleHtml = null;
        }
        echo HTML_comprofiler::_cbTemplateRender($cbTemplate, $myUser, 'List', 'drawListHead', array(&$lists, $listid, $total, $totalIsAllUsers, $searchTabContent, $searchResultDisplaying, $ue_base_url_non_sef, $listTitleHtml, $listDescription, $searchCriteriaTitleHtml, $searchResultsTitleHtml));
        ?>
  </form>
<?php 
        if ($searchmode == 0) {
            if (count($pluginAdditions['header'])) {
                echo '<div id="cbUserListHeader"><div>' . implode('</div><div>', $pluginAdditions['header']) . '</div></div>';
            }
            if ($showPaging && ($limitstart != 0 || $limit <= $total)) {
                // top page links:
                ?>
	<div class="cbUserListPagination cbUserListPaginationTop" style="width:100%;text-align:center;"><?php 
                echo writePagesLinks($limitstart, $limit, $total, $ue_base_url . $pagingSearch . $spoofAmp, $search);
                ?>
</div>
<?php 
            }
            // Render the list itself:
            echo HTML_comprofiler::_cbTemplateRender($cbTemplate, $myUser, 'List', 'drawListBody', array(&$users, &$columns, &$tableContent, $listid, $ueConfig['allow_profilelink']));
            if ($showPaging && ($limitstart != 0 || $limit <= $total)) {
                // bottom page links:
                ?>

	<div class="cbUserListPagination cbUserListPaginationBottom" style="width:100%;text-align:center;"><?php 
                echo writePagesLinks($limitstart, $limit, $total, $ue_base_url . $pagingSearch . $spoofAmp, $search);
                ?>
</div>
<?php 
            }
            if (count($pluginAdditions['footer'])) {
                echo '<div id="cbUserListFooter"><div>' . implode('</div><div>', $pluginAdditions['footer']) . '</div></div>';
            }
        }
        // end of if ( $searchmode == 0 )
        ?>

</div><div class="cbClr"> </div></div><div class="cbClr"> </div>
<?php 
    }
 /**
  * @param ListTable     $row
  * @param UserTable[]   $users
  * @param array         $columns
  * @param FieldTable[]  $fields
  * @param array         $input
  * @param string|null   $search
  * @param int           $searchmode
  * @param cbPageNav     $pageNav
  * @param UserTable     $myUser
  * @param FieldTable[]  $searchableFields
  * @param stdClass      $searchValues
  * @param cbTabs        $tabs
  * @param string|null   $errorMsg
  * @param bool          $listAll
  * @param int           $random
  */
 static function usersList(&$row, &$users, &$columns, &$fields, &$input, $search, $searchmode, $pageNav, &$myUser, &$searchableFields, &$searchValues, &$tabs, $errorMsg, $listAll = true, $random = 0)
 {
     global $_CB_framework, $_PLUGINS, $_POST, $_GET, $_REQUEST;
     $params = new Registry($row->params);
     // The Itemid for this userlist; kept for trigger B/C:
     $Itemid = getCBprofileItemid(null, 'userslist', '&listid=' . (int) $row->listid);
     $results = $_PLUGINS->trigger('onBeforeDisplayUsersList', array(&$row, &$users, &$columns, &$fields, &$input, $row->listid, &$search, &$Itemid, 1));
     // $uid = 1
     // Plugin content divided by location:
     $pluginAdditions = array('search', 'header', 'footer');
     $pluginAdditions['search'] = array();
     $pluginAdditions['header'] = array();
     $pluginAdditions['footer'] = array();
     if (is_array($results) && count($results) > 0) {
         foreach ($results as $res) {
             if (is_array($res)) {
                 foreach ($res as $k => $v) {
                     $pluginAdditions[$k][] = $v;
                 }
             }
         }
     }
     outputCbTemplate(1);
     outputCbJs();
     cbValidator::loadValidation();
     $cbTemplate = HTML_comprofiler::_cbTemplateLoad();
     if ($errorMsg) {
         $_CB_framework->enqueueMessage($errorMsg, 'error');
     }
     // Page title and pathway:
     $listTitleHtml = cbReplaceVars($row->title, $myUser);
     $listTitleNoHtml = strip_tags(cbReplaceVars($row->title, $myUser, false, false));
     $listDescription = cbReplaceVars($row->description, $myUser);
     $_CB_framework->setPageTitle($listTitleNoHtml);
     $_CB_framework->appendPathWay($listTitleHtml);
     // Add row click JS:
     if ($params->get('allow_profilelink', 1)) {
         $allowProfileLink = true;
     } else {
         $allowProfileLink = false;
     }
     $js = "var cbUserURLs = [];";
     if (is_array($users) && $allowProfileLink) {
         // Ensures the jQuery array index matches the same as HTML ID index (e.g. cbU0, cbU1):
         $index = 0;
         foreach ($users as $user) {
             $js .= "cbUserURLs[{$index}] = '" . addslashes($_CB_framework->userProfileUrl((int) $user->id, false)) . "';";
             $index++;
         }
     }
     $js .= "\$( '.cbUserListRow' ).click( function( e ) {" . "if ( ! ( \$( e.target ).is( 'a' ) || ( \$( e.target ).is( 'img' ) && \$( e.target ).parent().is( 'a' ) ) || \$( e.target ).hasClass( 'cbClicksInside' ) || ( \$( e.target ).parents( '.cbClicksInside' ).length > 0 ) || ( \$( this ).attr( 'id' ) == '' ) ) ) {" . "var index = \$( this ).prop( 'id' ).substr( 3 );";
     if ($allowProfileLink) {
         $js .= "window.location = cbUserURLs[index];";
     }
     $js .= "return false;" . "}" . "});";
     $_CB_framework->outputCbJQuery($js);
     // Search JS:
     $isSearching = $search !== null;
     if ($isSearching && $params->get('list_search_collapse', 0) && !in_array($searchmode, array(1, 2))) {
         $isCollapsed = true;
     } else {
         $isCollapsed = false;
     }
     if (count($searchableFields) > 0) {
         cbUsersList::outputAdvancedSearchJs($isCollapsed ? null : $search);
     }
     // Base form URL:
     $baseUrl = $_CB_framework->rawViewUrl('userslist', true, array('listid' => (int) $row->listid, 'searchmode' => 0), 'html', 0, '&listid=' . (int) $row->listid);
     // Searching attributes:
     $showAll = $search === null;
     $criteriaTitle = cbReplaceVars(CBTxt::Th('UE_SEARCH_CRITERIA', 'Search criteria'), $myUser);
     if ($searchmode == 0 || $searchmode == 1 && count(get_object_vars($searchValues)) || $searchmode == 2) {
         $resultsTitle = cbReplaceVars(CBTxt::Th('UE_SEARCH_RESULTS', 'Search results'), $myUser);
     } else {
         $resultsTitle = null;
     }
     // Search content:
     $searchTabContent = $tabs->getSearchableContents($searchableFields, $myUser, $searchValues, $params->get('list_compare_types', 0));
     if (count($pluginAdditions['search'])) {
         $searchTabContent .= '<div class="cbUserListSearchPlugins">' . '<div>' . implode('</div><div>', $pluginAdditions['search']) . '</div>' . '</div>';
     }
     // User row content:
     $tableContent =& HTML_comprofiler::_getListTableContent($users, $columns, $fields);
     if ($params->get('list_grid_layout', 0)) {
         $layout = 'grid';
     } else {
         $layout = 'list';
     }
     $gridHeight = (int) $params->get('list_grid_height', 200);
     $gridWidth = (int) $params->get('list_grid_width', 200);
     if ($params->get('list_show_selector', 1)) {
         $listSelector = true;
     } else {
         $listSelector = false;
     }
     $pageClass = $_CB_framework->getMenuPageClass();
     $return = '<div class="cbUsersList cb_template cb_template_' . selectTemplate('dir') . ($pageClass ? ' ' . htmlspecialchars($pageClass) : null) . '">' . '<form action="' . $_CB_framework->rawViewUrl('userslist', true, array('listid' => (int) $row->listid), 'html', 0, '&listid=' . (int) $row->listid) . '" method="get" id="adminForm" name="adminForm" class="cb_form form-auto cbValidation">' . '<input type="hidden" name="option" value="com_comprofiler" />' . '<input type="hidden" name="view" value="userslist" />' . (!$listSelector ? '<input type="hidden" name="listid" value="' . (int) $row->listid . '" />' : null) . '<input type="hidden" name="Itemid" value="' . (int) $Itemid . '" />' . '<input type="hidden" name="limitstart" value="0" />' . '<input type="hidden" name="searchmode" value="' . (int) $searchmode . '" />' . '<input type="hidden" name="search" value="" />' . ($random ? '<input type="hidden" name="rand" value="' . (int) $random . '" />' : null) . cbGetSpoofInputTag('userslist') . $_PLUGINS->callTemplate($cbTemplate, 'List', 'drawListHead', array(&$input, $row->listid, $pageNav->total, $showAll, $searchTabContent, $isSearching, $baseUrl, $listTitleHtml, $listDescription, $criteriaTitle, $resultsTitle, $listAll, $listSelector, $isCollapsed, $searchmode), 'html');
     if ($searchmode == 0 || $searchmode == 1 && count(get_object_vars($searchValues)) || $searchmode == 2) {
         $canPage = $params->get('list_paging', 1) && ($pageNav->limitstart != 0 || $pageNav->limit <= $pageNav->total);
         if (count($pluginAdditions['header'])) {
             $return .= '<div class="cbUserListHeader">' . '<div>' . implode('</div><div>', $pluginAdditions['header']) . '</div>' . '</div>';
         }
         $return .= $_PLUGINS->callTemplate($cbTemplate, 'List', 'drawListBody', array(&$users, &$columns, &$tableContent, $row->listid, $allowProfileLink, $layout, $gridHeight, $gridWidth, $searchmode), 'html');
         if ($canPage) {
             $return .= '<div class="cbUserListPagination cbUserListPaginationBottom text-center">' . $pageNav->getListLinks() . '</div>';
         }
         if (count($pluginAdditions['footer'])) {
             $return .= '<div class="cbUserListFooter">' . '<div>' . implode('</div><div>', $pluginAdditions['footer']) . '</div>' . '</div>';
         }
     }
     $return .= '</form>' . '</div>' . cbPoweredBy();
     echo $return;
     $_CB_framework->setMenuMeta();
 }