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\


// $Id: liste.php,v 1.2 2003/01/25 22:52:08 Onokazu Exp $
//  ------------------------------------------------------------------------ //
//                XOOPS - PHP Content Management System                      //
//                    Copyright (c) 2000 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 
"[ "// start of HTML
        
$counter 0;
        while (list(, 
$ltr) = each($alphabet)) {
                echo 
".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$ltr."&sortby=".$sortby."'>".$ltr."";
                if ( 
$counter == round($num/2) ) {
                    echo 
" ]nn[ "
                } elseif ( 
$counter != $num ) {
                    echo 
" | n";
                }
                
$counter++;
        }
        echo 
" ]n
nn";
}

if ( 
$xoopsConfig['startpage'] == "xoopsmembers" ) {
    
$xoopsOption['show_rblock'] =1;
    include(
XOOPS_ROOT_PATH."/header.php");
    
make_cblock();
    echo 
"";
} 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 
"";
printf(_ML_WELCOMETO,$xoopsConfig['sitename']);
echo 
"
n";
echo 
_ML_GREETINGS..XOOPS_URL."/userinfo.php?uid=".$lastuid."'>".$lastuser."
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 
"";
printf(_ML_WEHAVESOFAR,$numrows);
echo 
"
";
        
echo 
".XOOPS_URL."/modules/xoopsmembers/liste.php' method='post'>";
if ( isset(
$query) ) {
        echo 
"$query' />";
} else {
        echo 
"";
}
echo 
"._ML_SEARCH."' />";

echo 
".XOOPS_URL."/modules/xoopsmembers/liste.php' method='post'>";
echo 
"._ML_RESETSEARCH."' />";
echo 
"";
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 "";
if ( 
$letter != "front" ) {
    if ( 
$orderby == "ASC" ) {
        
$orderby "DESC";
    } else {
        
$orderby "ASC";
    }
    if ( !isset(
$query) ) {
        
$query "";
    }
    echo 
"n";
    echo 
"n";
    echo 
".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$letter."&sortby=user_avatar&orderby=".$orderby."&query=".$query."'>"._ML_AVATAR."n"
;
        echo 
".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$letter."&sortby=uname&orderby=".$orderby."&query=".$query."'>"._ML_NICKNAME."n"
;
        echo 
".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$letter."&sortby=name&orderby=".$orderby."&query=".$query."'>"._ML_REALNAME."n"
;
    echo 
".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$letter."&sortby=user_regdate&orderby=".$orderby."&query=".$query."'>"._ML_REGDATE."n"
;
        echo 
".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$letter."&sortby=email&orderby=".$orderby."&query=".$query."'>"._ML_EMAIL."n"
;
    echo 
".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$letter."&sortby=email&orderby=".$orderby."&query=".$query."'>"._ML_PM."n";
        echo 
".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$letter."&sortby=url&orderby=".$orderby."&query=".$query."'>"._ML_URL."n";
        
$cols 7;
        if ( 
$xoopsUser ) {
        if ( 
$xoopsUser->isAdmin() ) {
                    
$cols 8;
                    echo 
".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$letter."&sortby=email&orderby=".$orderby."&query=".$query."'>"._ML_FUNCTIONS."n";
        }
        }
        echo 
"";
        
$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 
".$dcolor."'>n";
            echo 
".XOOPS_URL."/uploads/".$userinfo->user_avatar()."' alt='' /> n";
            echo 
".XOOPS_URL."/userinfo.php?uid=".$userinfo->uid()."'>".$userinfo->uname("E")." n";
                        echo 
"".$userinfo->name("E")." n";
            echo 
"".formatTimeStamp($userinfo->user_regdate(),"m")." n";
            
$showmail 0;
            if ( 
$userinfo->user_viewemail() ) {
                
$showmail 1;
            } else {
                if ( 
$xoopsUser ) {
                    if ( 
$xoopsUser->isAdmin() ) {
                        
$showmail 1;
                    }
                }
                
            }
            if ( 
$showmail ){
                echo 
".$userinfo->email("E")."'>.XOOPS_URL."/images/icons/email.gif' border='0' alt='";
                
printf(_SENDEMAILTO,$userinfo->uname("E"));
                echo 
"' />n";
            } else {
                echo 
" n";
            }
            echo 
"";
            if ( 
$xoopsUser ) {
                echo 
"/pmlite.php?send2=1&to_userid=".$userinfo->uid()."","pmlite",450,370);'>";
                echo 
".XOOPS_URL."/images/icons/pm.gif' border='0' alt='";
                
printf(_SENDPMTO,$userinfo->uname("E"));
                echo 
"' />";
            } else {
                echo 
" ";
            }
            echo 
"n";
            if ( 
$userinfo->url("E") ) {
                            echo 
".$userinfo->url("E")."' target=new>.XOOPS_URL."/images/icons/www.gif' border='0' alt='"._VISITWEBSITE."' />n";
            } else {
                echo 
" n";
            }
                        if ( 
$xoopsUser ) {
                if ( 
$xoopsUser->isAdmin() ) {
                                echo 
".XOOPS_URL."/modules/system/admin.php?fct=users&op=reactivate&uid=".$userinfo->uid()."&op=modifyUser'>"._ML_EDIT." | n";
                                echo 
".XOOPS_URL."/modules/system/admin.php?fct=users&op=delUser&uid=".$userinfo->uid()."'>"._ML_DELETE." ]n";
                }
                        }
                        echo 
"";
                        
$a = ($dcolor == $dcolor_A 0);
                } 
// end while ()
        
echo "";
                
// start of next/prev/row links.
        
echo "";

                echo 
"n";
                
                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 
".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$letter."&sortby=".$sortby."&page=".$prev_page."'>";
                            echo 
"<<($prev_page)";
                        } else { 
                            echo 
" n"
                        }
                
                        echo 
"";
            
printf(_ML_USERSFOUND,$num_rows_per_order,$letter);
            echo 
" (";
                        
printf(_ML_PEGESUSERS,$total_pages,$num_users);
                        echo 
")";

                        
$next_page $page 1;
                        if ( 
$next_page <= $total_pages ) {
                            echo 
".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$letter."&sortby=".$sortby."&page=".$next_page."'>";
                            echo 
"(".$next_page.")>>";
                        } else {
                            echo 
" n"
                        }
    
/* Added a numbered page list, only shows up to 50 pages. */
                    
                        
echo "";
                        echo 
";
                        
                        for ( 
$n 1$n $total_pages$n++ ) {
                                if ( 
$n == $page ) {
                    echo 
"$n"
;
                                } else {
                    echo 
".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$letter."&sortby=".$sortby."&page=".$n."'>";
                    echo 
"$n"
;
                    }
                                if ( 
$n >= 50 ) {  // if more than 50 pages are required, break it at 50.
                                    
$break true
                                    break;
                                } else {  
// guess not.
                                    
echo " | "
                                }
                        }
                        
                        if(!isset(
$break)) { // are we sopposed to break ?
                    
if ( $n == $page ) {
                                echo 
"$n"
;
                    } else {
                                echo 
".XOOPS_URL."/modules/xoopsmembers/liste.php?letter=".$letter."&sortby=".$sortby."&page=".$total_pages."'>";
                                echo 
"$n"
;
                    }
                        }
                        echo 
] ";
                        echo 
"";

                }else{ 
                        echo 
"";
            
printf(_ML_USERSFOUND,$num_rows_per_order);
                        echo 
"";
                    
        }
                
                echo 
"n";

                
// end of next/prev/row links
                
    
} else {
                echo 
".$cols."' align='center'>n";
        echo 
"";
        
printf(_ML_NOUSERFOUND,$letter);
                echo 
"
n"
;
                echo 
"n";
                echo 
"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

549 user(s) are online (176 user(s) are browsing Support Forums)


Members: 0


Guests: 549


more...

Donat-O-Meter

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

Latest GitHub Commits