Firefox PHP

Userlist

Posted by Jeppe Bundsgaard 
Userlist
March 11, 2003 12:39AM
This script shows a list of all users with their picture and signature. Link to it e.g. at your forums main page.

remember to translate the linguistics in the beginning of the script.
Re: Userlist
March 12, 2003 03:59PM
Mhm... I think you forgot the File...

Re: Userlist
March 12, 2003 04:29PM
This is an edited version of the script...
<?php
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2000 Phorum Development Team //
// [www.phorum.org] //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// 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. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
// Contribution by Jeppe Bundsgaard
### New linguistics ###
$lImage="Image";
$lPage="Page";
$lUserlist="List of users";
$lShow="Showing";
$lTotalusers="total number of users";

###

### Options ###
//Show real name or nickname - uncomment the wanted option
$show_name="username";
//$show_name="name";
###

require './common.php';
include phorum_get_file_name('header');

if($subaction == "") {
$pagelength=50;
if(!$sort) {
$sort=$show_name;
}
$order = " order by $sort";

$SQL="select id,email,name,username,webpage,image,signature,hide_email from $pho_main"."_auth";
if($where){
$SQL.=" where username like '%$where%' or email like '%$where%'";
}
$SQL.=$order;

$q->query($DB, $SQL);

$users_found=$q->numrows();

$maxpages=$users_found/$pagelength;
if($maxpages > intval($maxpages))
$maxpages=intval(++$maxpages);

$i=0;
$j=0;
if(!$st)
$st=0;
while($row=$q->getrow()) {
$i++;
if(($i-1)<$st)
continue;
if(($i-1)>=($st+$pagelength))
break;
$users[$j]=$row;
$j++;
}

$SQL="select count(*) as count from $pho_main"."_auth";
$q->query($DB, $SQL);
$row=$q->getrow();
$total_users=$row['count'];
if($st==0) {
$backlink="&nbsp;";
} else {
$backlink="<a href=\"$myname?sort=$sort&where=$where&st=".($st-$pagelength)."\">back</a>";
}
if(($st+$pagelength)>=$total_users) {
$forwardlink="&nbsp;";
} else {
$forwardlink="<a href=\"$myname?sort=$sort&where=$where&st=".($st+$pagelength)."\">forward</a>";
}

$page=$st/$pagelength+1;

//Post Count Function
function Count_Posts($user_id){
global $DB,$pho_main;
//Get list of the forums
$sql="Select distinct(table_name) from ".$pho_main." where active='1' AND folder='0'";
$q=new query($DB, $sql);
$forums=$q->getrow();
$totalposts=0;
//Output them in the scipt
while(is_array($forums)){
//Count posts in each forum
$sql="SELECT count(*) as posts FROM $forums[table_name] WHERE userid='$user_id'";
$query=new query($DB, $sql);
$rec=$query->getrow();
$posts=$rec['posts'];
//Add Them To totals
$totalposts=$totalposts+$posts;
$forums=$q->getrow();
}
return $totalposts;
}
echo "<h2>$lUserlist</h2>";
?>

<table border="0" cellspacing="0" cellpadding="3">
<tr>
<td nowrap width="50%" align="left" valign="middle"><?php echo $lShow." ".$users_found." ".$lOf." ".$total_users." ".$lTotalusers; ?></td>
<td nowrap width="50%" align="right" valign="middle"><form style="align: right; display: inline;" action="<?php echo $myname; ?>" method="get"><input type="text" name="where" size="20" value="<?=$where?>" /><input type="submit" value="Search" /></form></td>
</tr>
</table>
<hr width="600"/>
<table border="0" cellspacing="0" cellpadding="3">
<tr>
<td nowrap width="10%" align="center" valign="middle"><?php echo $backlink;?></td>
<td nowrap width="80%" align="center" valign="middle"><center><?php print "$lPage $page $lOf $maxpages";?></center></td>
<td nowrap width="10%" align="center" valign="middle"><?php echo $forwardlink;?></td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="3" class="box-table">
<tr>
<td class="table-header"><a href="<?php echo $myname."?where=$where&sort=$show_name\">".$lName; ?></a></td>
<td class="table-header"><a href="<?php echo $myname."?where=$where&sort=email\">".$lEmail; ?></a></td>
<td class="table-header"><a href="<?php echo $myname."?where=$where&sort=webpage\">".$lWebpage; ?></a></td>
<td class="table-header"><?php echo $lImage; ?></td>
<td class="table-header"><?php echo $lSignature; ?></td>
<td class="table-header"><?php echo $lNumPosts; ?></td>
</tr>
<?php
$i=0;
while($row=$users[$i]) {
?>
<tr>
<td valign="middle"><?php echo $row[$show_name];?></td>
<td valign="middle"><?php if (!$hide_email) echo "<a href=\"mailto:".$row['email']."\">".$row['email']."</a>";?></td>
<td valign="middle"><?php echo "<a href=\"".$row['webpage']."\">".$row['webpage']."</a>";?></td>
<td valign="middle"><?php if ($row['image']) echo "<image src=\"".$row['image']."\" width=50>";?></td>
<td valign="middle" align="left"><?php echo my_nl2br(htmlspecialchars($row['signature']));?></td>
<td valign="middle"><?php echo Count_Posts($row['id']); ?></td>

</tr>
<?php
$i++;
}
?>
</table>

<?php }
include phorum_get_file_name('footer');
?>



Post Edited (03-13-03 09:45)
Re: Userlist
March 13, 2003 04:25PM
Yes, now it works :-)

But the name is my real name, but i need the Username. How could i change it?



Post Edited (03-13-03 09:45)
Re: Userlist
March 13, 2003 04:50PM
Hi Stormi,

I edited the script directly in the post above to fit your needs.

by the way - with a little creativity I think you would be capable of figuring out what the danish words means - german and danish are after all almost the same language ;-)

jeppe
Re: Userlist
March 13, 2003 05:33PM
You're right, i've translated it already ;-)
It was very easy.
Now it is all perfectly working, well, if you want to look, you can do it here: www.gwf.gustelli.de/userlist.php ;-)
I've changed some things so it's like my Homepagedesign ;-)

Thank you for the very good script!



Post Edited (03-13-03 10:41)
Re: Userlist
April 04, 2003 10:57PM
is there an easy way to enable linking through clicking on usernames ?
i am very slowly learning PHP, but havent been able to do it yet.
Re: Userlist
April 04, 2003 11:04PM
I guess replacing this:

<td valign="middle"><?php echo $row[$show_name];?></td>

by this:

<td valign="middle"><?php echo "<a href=\"".$row['webpage']."\">".$row[$show_name]."</a>";?></td>

should do. (And then you can omit the line showing the webpage)
Jeppe
Re: Userlist
August 13, 2003 05:16PM
nice script, different than the one I saw on
[havoc.thatbitch.com]

could you post the complete code including ICQ?!
i like the picture preview:)
Re: Userlist
August 14, 2003 09:28AM
You'll have to add two lines like these. Find them in the code and add them there with webpage replaced by ICQ or whatever of the personal information you want.

<td class="table-header"><?php echo $lWebpage; ?></td>

<td valign="middle"><?php echo "<a href=\"".$row['webpage']."\">".$row['webpage']."</a>";?></td>

jeppe

Re: Userlist
September 06, 2003 09:18PM
Would't it be even better if a click on the username took you to the users profile?
Re: Userlist
October 16, 2003 12:22PM
A bug in this one is that it shows the email address even if the user has ticked the "Hide my email from other users".
Re: Userlist
November 09, 2003 03:21PM
Fine script, thanx.
Re: Userlist
February 03, 2004 11:30PM
Does anybody know how to get tis script :

[havoc.thatbitch.com]

This is great
dd
Re: Userlist
March 15, 2004 09:57PM
Re: Userlist
August 19, 2004 10:23PM
Hey, I recently found this script and I must admit that it's amusing.

I was trying to improve it a bit, so that clicking one's name would open their profile.

I replaced
<td valign="middle"><?php echo $row[$show_name];?></td>
with:
<td valign="middle"><?php echo "<a href=\"$forum_url/profile.$ext?f=$ForumId&id=$head_row[userid]$GetVars\">".$row[$show_name]."</a>";?></td>

With no luck though :-(


I also had to put contents of that page into an extra table, so that the text would be on a readable background. I'm also discovering the possibility to put menus similiar to other pages on that userlist.php

If someone can be of help, even though this topic is somewhat old, I'd be thankful.

Wille
(and the page is [www.fromashes.com])
Sorry, you do not have permission to post/reply in this forum.