1
Xtracted
List members?
  • 2004/1/13 15:55

  • Xtracted

  • Not too shy to talk

  • Posts: 138

  • Since: 2004/1/7 2


I am looking for a way to list members without the search member function.. Just a way to list all members with a link from the main menu.. suggestions?

2
chapi
Re: List members?
  • 2004/1/13 15:57

  • chapi

  • Theme Designer

  • Posts: 611

  • Since: 2002/1/22



3
Mithrandir
Re: List members?

Not tested, but maybe lookie here

4
Xtracted
Re: List members?
  • 2004/1/13 16:11

  • Xtracted

  • Not too shy to talk

  • Posts: 138

  • Since: 2004/1/7 2


Great, it worked.. can I remove the "Search Members »» Search results" link that gets added to the top of the page, somehow?

5
Mithrandir
Re: List members?

Edit the template

6
shino
Re: List members?
  • 2004/1/13 19:42

  • shino

  • Theme Designer

  • Posts: 23

  • Since: 2003/7/16


create list.php
in > \modules\xoopsmembers\


<?php
// $Id: liste.php,v 1.2 2003/01/25 22:52:08 Onokazu Exp $
//  ------------------------------------------------------------------------ //
//                XOOPS - PHP Content Management System                      //
//                    Copyright (c) 2000 XOOPS.org                           //
//                       <https://xoops.org/>                             //
// ------------------------------------------------------------------------- //
//  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.                                      //
//                                                                           //
//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  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 //
//  ------------------------------------------------------------------------ //
include "../../mainfile.php";
include 
"../../header.php";
function 
alpha() {
    global 
$sortby$xoopsConfig;
    
$alphabet = array (_ML_ALL"A","B","C","D","E","F","G","H","I","J","K","L","M",
                            
"N","O","P","Q","R","S","T","U","V","W","X","Y","Z",_ML_OTHER);
        
$num count($alphabet) - 1;
        echo 
"<div align='center'>[ "// start of HTML
        
$counter 0;
        while (list(, 
$ltr) = each($alphabet)) {
                echo 
"<a href='".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$ltr."&amp;sortby=".$sortby."'>".$ltr."</a>";
                if ( 
$counter == round($num/2) ) {
                    echo 
" ]n<br />n[ "
                } elseif ( 
$counter != $num ) {
                    echo 
"&nbsp;|&nbsp;n";
                }
                
$counter++;
        }
        echo 
" ]n</div>n<br />n";
}

if ( 
$xoopsConfig['startpage'] == "xoopsmembers" ) {
    
$xoopsOption['show_rblock'] =1;
    include(
XOOPS_ROOT_PATH."/header.php");
    
make_cblock();
    echo 
"<br />";
} else {
    
$xoopsOption['show_rblock'] =0;
    include(
XOOPS_ROOT_PATH."/header.php");
}
$pagesize 20;

if ( !isset(
$letter) ) { $letter _ML_ALL; }
if ( !isset(
$sortby) ) { $sortby "uid"; }
if ( !isset(
$orderby) ) { $orderby "ASC"; }
if ( !isset(
$page) ) { $page 1; }

if ( isset(
$query) ) {
        
$where "WHERE level>0 AND (uname LIKE '%$query%' OR user_icq LIKE '%$query%' ";
        
$where .= "OR user_from LIKE '%$query%' OR user_sig LIKE '%$query%' ";
        
$where .= "OR user_aim LIKE '%$query%' OR user_yim LIKE '%$query%' OR user_msnm like '%$query%'";
    if ( 
$xoopsUser ) {
            if ( 
$xoopsUser->isAdmin() ) {
                
$where .= " OR email LIKE '%$query%'";
        }
        }
    
$where .= ") ";
} else {
        
$where "WHERE level>0";
}
$result $xoopsDB->query("SELECT uid, uname FROM ".$xoopsDB->prefix("users").$where ORDER BY uid DESC",1,0);
list(
$lastuid$lastuser) = $xoopsDB->fetchRow($result);

OpenTable();
echo 
"<div align='center'><b>";
printf(_ML_WELCOMETO,$xoopsConfig['sitename']);
echo 
"</b><br /><br />n";
echo 
_ML_GREETINGS." <a href='".XOOPS_URL."/userinfo.php?uid=".$lastuid."'>".$lastuser."</a></div>n";
if (isset(
$query) && trim($query) != "") {
        
$where "WHERE level>0 AND (uname LIKE '%$query%' OR user_icq LIKE '%$query%' ";
        
$where .= "OR user_from LIKE '%$query%' OR user_sig LIKE '%$query%' ";
        
$where .= "OR user_aim LIKE '%$query%' OR user_yim LIKE '%$query%' OR user_msnm like '%$query%'";
        if ( 
$xoopsUser ) {
        if ( 
$xoopsUser->isAdmin() ) {
                
$where .= " OR email LIKE '%$query%'";
            }
    }
    
$where .= ") ";
} else {
        
$where "WHERE level>0";
}

list(
$numrows) = $xoopsDB->fetchRow($xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("users").$where"));

echo 
"<div align='center'>";
printf(_ML_WEHAVESOFAR,$numrows);
echo 
"</div><br /><br />";
        
echo 
"<table align='center'><tr><td align='right' width=58%><form action='".XOOPS_URL."/modules/xoopsmembers/liste.php' method='post'>";
if ( isset(
$query) ) {
        echo 
"<input type='text' size='30' name='query' value='$query' />";
} else {
        echo 
"<input type='text' size='30' name='query' />";
}
echo 
"<input type='submit' value='"._ML_SEARCH."' /></form></td><td>";

echo 
"<form action='".XOOPS_URL."/modules/xoopsmembers/liste.php' method='post'>";
echo 
"<input type='submit' value='" ._ML_RESETSEARCH."' />";
echo 
"</form></td></tr></table>";
alpha();

$min $pagesize * ($page 1); 
$max $pagesize
        
$count "SELECT COUNT(uid) AS total FROM ".$xoopsDB->prefix("users")." "// Count all the users in the db..
$select "SELECT uid, name, uname, email, url, user_avatar, user_regdate, user_icq, user_from, user_aim, user_yim, user_msnm, user_viewemail FROM ".$xoopsDB->prefix("users")." ";
if ( ( 
$letter != _ML_OTHER ) AND ( $letter != _ML_ALL ) ) {
    
$where "WHERE level>0 AND uname LIKE '".$letter."%' ";
} else if ( ( 
$letter == _ML_OTHER ) AND ( $letter != _ML_ALL ) ) {
        
$where "WHERE level>0 AND uname REGEXP '^[1-9]' "
} else { 
        
$where "WHERE level>0 "
}
$sort "order by $sortby $orderby";


if ( isset(
$query) ) {
        
$where "WHERE level>0 AND (uname LIKE '%$query%' OR user_icq LIKE '%$query%' ";
        
$where .= "OR user_from LIKE '%$query%' OR user_sig LIKE '%$query%' ";
        
$where .= "OR user_aim LIKE '%$query%' OR user_yim LIKE '%$query%' OR user_msnm LIKE '%$query%'";
        if ( 
$xoopsUser ) {
        if ( 
$xoopsUser->isAdmin() ) {
                
$where .= "OR email LIKE '%$query%'";
        }
        }
    
$where .= ") ";
}
$count_result $xoopsDB->query($count.$where);
list(
$num_rows_per_order) = $xoopsDB->fetchRow($count_result);

$result $xoopsDB->query($select.$where.$sort,$max,$min) or die($xoopsDB->error() ); // Now lets do it !!
echo "<br />";
if ( 
$letter != "front" ) {
    if ( 
$orderby == "ASC" ) {
        
$orderby "DESC";
    } else {
        
$orderby "ASC";
    }
    if ( !isset(
$query) ) {
        
$query "";
    }
    echo 
"<table border='0' cellpadding='0' cellspacing='0' valign='top' width='100%' class='head'><tr><td>n";
    echo 
"<table width='100%' border='0' cellspacing='1' cellpadding='4'><tr>n";
    echo 
"<td align='center'><span ><b><a href='".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$letter."&amp;sortby=user_avatar&amp;orderby=".$orderby."&amp;query=".$query."'>"._ML_AVATAR."</a></b></span></td>n";
        echo 
"<td align='center'><span ><b><a href='".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$letter."&amp;sortby=uname&amp;orderby=".$orderby."&amp;query=".$query."'>"._ML_NICKNAME."</a></b></span></td>n";
        echo 
"<td align='center'><span ><b><a href='".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$letter."&amp;sortby=name&amp;orderby=".$orderby."&amp;query=".$query."'>"._ML_REALNAME."</a></b></span></td>n";
    echo 
"<td align='center'><span ><b><a href='".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$letter."&amp;sortby=user_regdate&amp;orderby=".$orderby."&amp;query=".$query."'>"._ML_REGDATE."</a></b></span></td>n";
        echo 
"<td align='center'><span ><b><a href='".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$letter."&amp;sortby=email&amp;orderby=".$orderby."&amp;query=".$query."'>"._ML_EMAIL."</a></b></span></td>n";
    echo 
"<td align='center'><span ><b><a href='".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$letter."&amp;sortby=email&amp;orderby=".$orderby."&amp;query=".$query."'>"._ML_PM."</a></b></span></td>n";
        echo 
"<td align='center'><span ><b><a href='".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$letter."&amp;sortby=url&amp;orderby=".$orderby."&amp;query=".$query."'>"._ML_URL."</a></b></span></td>n";
        
$cols 7;
        if ( 
$xoopsUser ) {
        if ( 
$xoopsUser->isAdmin() ) {
                    
$cols 8;
                    echo 
"<td align='center'><span ><b><a href='".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$letter."&amp;sortby=email&amp;orderby=".$orderby."&amp;query=".$query."'>"._ML_FUNCTIONS."</a></b></span></td>n";
        }
        }
        echo 
"</tr>";
        
$a 0;
        
$dcolor_A "odd";
        
$dcolor_B "even";

        
$num_users $xoopsDB->getRowsNum($result); //number of users per sorted and limit query
        
if ( $num_rows_per_order 0  ) {
                while ( 
$userinfo $xoopsDB->fetchArray($result) ) {
            
$userinfo = new XoopsUser($userinfo['uid']);
                        
$dcolor = ($a == $dcolor_A $dcolor_B);
                        echo 
"<tr class='".$dcolor."'>n";
            echo 
"<td align='center'><img src='".XOOPS_URL."/uploads/".$userinfo->user_avatar()."' alt='' />&nbsp;</td>n";
            echo 
"<td align='center'><a href='".XOOPS_URL."/userinfo.php?uid=".$userinfo->uid()."'>".$userinfo->uname("E")."</a>&nbsp;</td>n";
                        echo 
"<td>".$userinfo->name("E")."&nbsp;</td>n";
            echo 
"<td align='center'>".formatTimeStamp($userinfo->user_regdate(),"m")."&nbsp;</td>n";
            
$showmail 0;
            if ( 
$userinfo->user_viewemail() ) {
                
$showmail 1;
            } else {
                if ( 
$xoopsUser ) {
                    if ( 
$xoopsUser->isAdmin() ) {
                        
$showmail 1;
                    }
                }
                
            }
            if ( 
$showmail ){
                echo 
"<td align='center'><a href='mailto:".$userinfo->email("E")."'><img src='".XOOPS_URL."/images/icons/email.gif' border='0' alt='";
                
printf(_SENDEMAILTO,$userinfo->uname("E"));
                echo 
"' /></a></td>n";
            } else {
                echo 
"<td>&nbsp;</td>n";
            }
            echo 
"<td align='center'>";
            if ( 
$xoopsUser ) {
                echo 
"<a href='javascript:openWithSelfMain("".XOOPS_URL."/pmlite.php?send2=1&amp;to_userid=".$userinfo->uid()."","pmlite",450,370);'>";
                echo 
"<img src='".XOOPS_URL."/images/icons/pm.gif' border='0' alt='";
                
printf(_SENDPMTO,$userinfo->uname("E"));
                echo 
"' /></a>";
            } else {
                echo 
"&nbsp;";
            }
            echo 
"</td>n";
            if ( 
$userinfo->url("E") ) {
                            echo 
"<td align='center'><a href='".$userinfo->url("E")."' target=new><img src='".XOOPS_URL."/images/icons/www.gif' border='0' alt='"._VISITWEBSITE."' /></a></td>n";
            } else {
                echo 
"<td>&nbsp;</td>n";
            }
                        if ( 
$xoopsUser ) {
                if ( 
$xoopsUser->isAdmin() ) {
                                echo 
"<td align='center'>[ <a href='".XOOPS_URL."/modules/system/admin.php?fct=users&amp;op=reactivate&amp;uid=".$userinfo->uid()."&amp;op=modifyUser'>"._ML_EDIT."</a> | n";
                                echo 
"<a href='".XOOPS_URL."/modules/system/admin.php?fct=users&amp;op=delUser&amp;uid=".$userinfo->uid()."'>"._ML_DELETE."</a> ]</td>n";
                }
                        }
                        echo 
"</tr>";
                        
$a = ($dcolor == $dcolor_A 0);
                } 
// end while ()
        
echo "</table></td></tr></table>";
                
// start of next/prev/row links.
        
echo "<br /><br />";

                echo 
"n<table height='20' width='100%' cellspacing='0' cellpadding='0' border='0' ><tr><td class='bg1'>";
                
                if ( 
$num_rows_per_order $pagesize ) { 
                        
$total_pages ceil($num_rows_per_order $pagesize); // How many pages are we dealing with here ??
                        
$prev_page $page 1;
                    
                        if ( 
$prev_page ) {
                            echo 
"<td align='left' width='15%'><a href='".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$letter."&amp;sortby=".$sortby."&amp;page=".$prev_page."'>";
                            echo 
"<<($prev_page)</a></td>";
                        } else { 
                            echo 
"<td width='15%'>&nbsp;</td>n"
                        }
                
                        echo 
"<td align='center' width='70%'>";
            
printf(_ML_USERSFOUND,$num_rows_per_order,$letter);
            echo 
" (";
                        
printf(_ML_PEGESUSERS,$total_pages,$num_users);
                        echo 
")</td>";

                        
$next_page $page 1;
                        if ( 
$next_page <= $total_pages ) {
                            echo 
"<td align='right' width='15%'><a href='".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$letter."&amp;sortby=".$sortby."&amp;page=".$next_page."'>";
                            echo 
"(".$next_page.")>></a></td>";
                        } else {
                            echo 
"<td width='15%'>&nbsp;</td>n"
                        }
    
/* Added a numbered page list, only shows up to 50 pages. */
                    
                        
echo "</tr><tr><td colspan='3' align='center'>";
                        echo 
" <small>[ </small>";
                        
                        for ( 
$n 1$n $total_pages$n++ ) {
                                if ( 
$n == $page ) {
                    echo 
"<small><b>$n</b></small></a>";
                                } else {
                    echo 
"<a href='".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$letter."&amp;sortby=".$sortby."&amp;page=".$n."'>";
                    echo 
"<small>$n</small></a>";
                    }
                                if ( 
$n >= 50 ) {  // if more than 50 pages are required, break it at 50.
                                    
$break true
                                    break;
                                } else {  
// guess not.
                                    
echo "<small> | </small>"
                                }
                        }
                        
                        if(!isset(
$break)) { // are we sopposed to break ?
                    
if ( $n == $page ) {
                                echo 
"<small><b>$n</b></small></a>";
                    } else {
                                echo 
"<a href='".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$letter."&amp;sortby=".$sortby."&amp;page=".$total_pages."'>";
                                echo 
"<small>$n</small></a>";
                    }
                        }
                        echo 
" <small>]</small> ";
                        echo 
"</td></td></tr>";

                }else{ 
                        echo 
"<td align='center'>";
            
printf(_ML_USERSFOUND,$num_rows_per_order);
                        echo 
"</td></td></tr>";
                    
        }
                
                echo 
"</table>n";

                
// end of next/prev/row links
                
    
} else {
                echo 
"<tr><td class='bg3' colspan='".$cols."' align='center'><br />n";
        echo 
"<b>";
        
printf(_ML_NOUSERFOUND,$letter);
                echo 
"</b>n";
                echo 
"<br /></td></tr>n";
                echo 
"</table></td></tr></table><br />n";
        }
}
CloseTable();
include(
XOOPS_ROOT_PATH."/footer.php");

?>

7
Xtracted
Re: List members?
  • 2004/1/16 15:31

  • Xtracted

  • Not too shy to talk

  • Posts: 138

  • Since: 2004/1/7 2


Since I have got so much help here, Ill try again with a new issue.. =)


I have done the modifications to the "members" module on my page and it works fine.. now when I click "members" in the menu, I immediately get a list of all registered members.. But there is one more thing I would like to add to that list..

I would like that peoples "rank" was shown on that page.. any suggestions.. ? =)

8
Mithrandir
Re: List members?

$thisUser->rank(); ?

9
Xtracted
Re: List members?
  • 2004/1/16 15:35

  • Xtracted

  • Not too shy to talk

  • Posts: 138

  • Since: 2004/1/7 2


Ehm..where? how? =) I dont know php very well.. hardly at all really.. =)

10
Mithrandir
Re: List members?

I assume you used the previous tricks to get an array of members, right?

Those members are assigned to Smarty in some way (with a $xoopsTpl->assign('something' => $somethingelse); )

So in between these two operations, you can put a (not proper syntax, but outlining the principle)
foreach ($user as $thisuser) {
$users['name'] = $thisuser->getVar('uname');
$users['rank'] = $thisuser->rank();
...
...
}
$xoopsTpl->assign('users' => $users);

Login

Who's Online

162 user(s) are online (103 user(s) are browsing Support Forums)


Members: 0


Guests: 162


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits