Quote by mthomas:but I have not seen any view all members and scroll through to find or search for a member plugins.
Text Formatted Code
<?php
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// | Geeklog 1.3 |
// +---------------------------------------------------------------------------+
// | userlist.php v2 |
// | Lists the registered users of a Geeklog site in alphabetical oder and<br>
// | include a simple search function |
// | |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2002 by the following authors: |
// | |
// | Author: Dirk Haun <dirk@haun-online.de> |
// | based on code taken from Geeklog 1.3.x
// | changed by Yulia Parkanska
// | |
// +---------------------------------------------------------------------------+
// | |
// | This program is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public License |
// | as published by the Free Software Foundation; either version 2 |
// | of the License, or (at your option) any later version. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software Foundation, |
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +---------------------------------------------------------------------------+
//
// You can change the number of users displayed per page by adjusting the
// value $limit = 50; below accordingly ...
require_once ("lib-common.php");
function listusers($offset,$curpage, $query = '', $query_limit = 75)
{
global $_TABLES, $_CONF, $LANG01, $LANG04, $LANG28;
$limit = 50; // this is the number of users listed per page
$retval = COM_startBlock($LANG01[17]);
$retval .= '<p align="center">You can do simple searches by entering parts of a username, email address or fullname(e.g. *son* or *.edu) in the form below.</p>'. LB;
$retval .= '<table border="0" cellspacing="1" cellpadding="1" width="100%" align="center" class="globalSolidOutline">' . LB;
$retval .= '<tr><td colspan="5" align="center" class="globalCellText">
<form action="'.$_CONF['site_url'].'/userlist.php" method="post">'
.$LANG28[26]. ': <input class="searchGadget" type="text" size="20" name="q" value="'.$query.'">
<input class="context" type="submit" value=" Search ">
</form></td></tr>'. LB;
$retval .= '<tr><td class="globalCellTitle"><b>' . $LANG04[2] . '</b></td><td class="globalCellTitle"><b>' . $LANG04[3] . '</b></td><td class="globalCellTitle"><b>' . $LANG04[81] .'</b></td><td class="globalCellTitle"><b>' . $LANG28[35] .'</b></td></tr>' . LB;
// $num_pages = ceil(DB_getItem($_TABLES['users'],'count(*)','uid > 1') / $limit);
// $offset = ($curpage - 1) * $limit;
if (empty($query_limit)) {
$limit = 75;
} else {
$limit = $query_limit;
}
if (!empty($query)) {
$query = str_replace('*','%',$query);
$num_pages = ceil(DB_getItem($_TABLES['users'],'count(*)',"uid > 1 AND username LIKE '$query'") / $limit);
if ($num_pages < $curpage) {
$curpage = 1;
}
} else {
$num_pages = ceil(DB_getItem($_TABLES['users'],'count(*)','uid > 1') / $limit);
}
$offset = ($curpage - 1) * $limit;
// $sql = "SELECT uid,username,fullname,email,photo FROM {$_TABLES['users']} WHERE uid > 1 order by username LIMIT $offset,$limit";
if (!empty($query)) {
$sql = "SELECT {$_TABLES['users']}.uid,username,fullname,email,photo,lastlogin FROM {$_TABLES['users']},{$_TABLES['userinfo']} WHERE {$_TABLES['users']}.uid > 1 AND {$_TABLES['users']}.uid={$_TABLES['userinfo']}.uid AND (username LIKE '$query' OR email LIKE '$query' OR fullname LIKE '$query' OR {$_TABLES['userinfo']}.pgpkey LIKE '$query' ) order by username LIMIT $offset,$limit";
} else {
$sql = "SELECT uid,username,fullname,email,photo FROM {$_TABLES['users']} WHERE uid > 1 order by username LIMIT $offset,$limit";
}
$result = DB_query($sql);
$nrows = DB_numRows($result);
for ($i = 0; $i < $nrows; $i++) {
$A = DB_fetchArray($result);
$retval .= '<tr><td class="globalCellText" style="line-height: 1.5em"><a href="' . $_CONF['site_url']
. '/users.php?mode=profile&uid=' . $A['uid'] . '">'
. $A['username'] . '</a>';
if (!empty($A['photo']))
//AND $_CONF['allow_user_photo'] == 1)
{$retval .= ' <a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid'] . '"><img src="' . $_CONF['layout_url'] . '/images/smallcamera.gif" border="0" alt="" /></a>';
}
$curtime = COM_getUserDateTimeFormat($A["lastlogin"]);
$A['lastlogin'] = $curtime[0];
$retval .= '</td><td class="globalCellText">' . $A['fullname']
. '</td><td class="globalCellText"><a href="' . $_CONF['site_url']
. '/profiles.php?uid=' . $A['uid']
. '">' . $LANG04[81] .'</a></td><td class="globalCellText" align="right">' . $A['lastlogin']
. '</td></tr>' . LB;
}
$retval .= '</table>' . LB;
if (!empty($query)) {
$query = str_replace('%','*',$query);
$base_url = $_CONF['site_url'] . '/userlist.php?q=' . urlencode($query) . '&query_limit=' . $query_limit;
} else {
$base_url = $_CONF['site_url'] . '/userlist.php?query_limit=' . $query_limit;
}
if ($num_pages > 1) {
$retval .= '<p>' . COM_printPageNavigation ($base_url, $curpage, $num_pages) . '</p>';
}
$retval .= COM_endBlock();
return $retval;
}
// MAIN
$display = COM_siteHeader ('menu');
if (empty ($_USER['username'])) { // prevent anon users from viewing the list
// The following will only work in Geeklog 1.3.6rc1 and up
$display .= COM_startBlock($LANG_LOGIN[1]);
$login = new Template($_CONF['path_layout'] . 'submit');
$login->set_file (array ('login'=>'submitloginrequired.thtml'));
$login->set_var ('login_message', $LANG_LOGIN[2]);
$login->set_var ('site_url', $_CONF['site_url']);
$login->set_var ('lang_login', $LANG_LOGIN[3]);
$login->set_var ('lang_newuser', $LANG_LOGIN[4]);
$login->parse ('output', 'login');
$display .= $login->finish ($login->get_var('output'));
$display .= COM_endBlock();
if (empty($offset)) {
$offset = 0;
}
} else {
if (empty($offset)) {
$offset = 0;
}
if (empty($page)) {
$page = 1;
}
$display .= listusers($offset,$page,$q,$query_limit);
}
$display .= COM_siteFooter();
echo $display;
?>
"I love deadlines. I like the whooshing sound they make as they fly by." -- Douglas Adams