The Arcive of vBulletin Modifications Site. |
|
Details »»
|
|||||||||||||||||||||||||
Yup, I'm quick. 2 days after the program is released and people (well, me) are already releasing hacks.This is a port of the memberlist hack from UBB. But it also has a decent search feature too. Copy all the code into memberlist.php and put it in your main vBulletin directory. Here is my demo: http://www.magic-singles.com/cpa/forums/memberlist.php (NOTE: THIS IS THE TEMPLATE-IZED VERSION) Now, here's the code: Code:
<?
require("global.php");
//TOP POSTERS AMOUNT
$topposternum = 10;
if ($numperpage=="") {
// NUMBER OF RECORDS PER PAGE
$numperpage = 30;
}
$numperpage2 = $numperpage;
$numperpage -= 1;
if (isset($action)==0 or $action=="") {
$action="getall";
}
if ($action=="getall") {
$cssinclude = gettemplate("cssinclude");
$condition="1=1";
if ($ausername!="") {
$condition.=" AND INSTR(username,'".$ausername."')>0";
}
if ($email!="") {
$condition.=" AND INSTR(email,'".$email."')>0";
}
if ($homepage!="") {
$condition.=" AND INSTR(homepage,'".$homepage."')>0";
}
if ($icq!="") {
$condition.=" AND INSTR(icq,'".$icq."')>0";
}
if ($aim!="") {
$condition.=" AND INSTR(aim,'".$aim."')>0";
}
if ($yahoo!="") {
$condition.=" AND INSTR(yahoo,'".$yahoo."')>0";
}
if ($biography!="") {
$condition.=" AND INSTR(biography,'".$biography."')>0";
}
if ($joindateafter!="") {
$condition.=" AND joindate>'".$joindate."'";
}
if ($joindatebefore!="") {
$condition.=" AND joindate<'".$joindatebefore."'";
}
if ($postslower!="") {
$condition.=" AND posts>$postslower";
}
if ($postsupper!="") {
$condition.=" AND posts<$postsupper";
}
if ($orderby=="") {
$orderby="username";
}
if ($limitstart=="") {
$limitstart=0;
} else {
$limitstart--;
}
if ($limitnumber=="") {
$limitnumber=($numperpage + 1);
}
$memberlistbit = "";
$temp = 0;
$users=$DB_site->query("SELECT userid,username,email,icq,aim,yahoo,biography,posts,joindate FROM user WHERE $condition ORDER BY $orderby $direction LIMIT $limitstart,$limitnumber");
while ($user=$DB_site->fetch_array($users)) {
$temp = $temp + 1;
$username = $user[username];
$userid = $user[userid];
$joindate = $user[joindate];
$posts = $user[posts];
$bio = str_replace(",", ", ", $user[biography]);
$bio = str_replace("\n", "\n<BR>", $bio);
if ($user[icq]!="") {
$icqM = "<a href=\"http://wwp.icq.com/$user[icq]#pager\" target=_blank><img src=\"http://online.mirabilis.com/scripts/online.dll?icq=$user[icq]&img=5\" alt=\"$user[username]\'s ICQ status\" border=0></a>";
} else {
$icqM = " ";
}
if ($user[aim]!="") {
$aimM = "<a href=\"javascript:aimwindow('$user[aim]')\"><img src=\"images/aim.gif\" alt=\"Send a AIM message to $user[username]\" border=0></a>";
} else {
$aimM = " ";
}
if ($user[yahoo]!="") {
$yahooM = "<a href=\"http://edit.yahoo.com/config/send_webmesg?.target=\$yahoohandle&.src=pg\" target=\"_blank\"><img src=\"http://opi.yahoo.com/online?u=$user[yahoo]&m=g&t=1\" alt=\"Send a message to $user[username]\" border=0></a>";
} else {
$yahooM = " ";
}
eval("\$memberlistbit .= \"".gettemplate("memberlistbit")."\";");
} #end while
if ($top!="true") {
$memberlistpages = "Page: ";
$numbersmembers=$DB_site->query_first("SELECT COUNT(userid) AS users FROM user WHERE $condition");
$numbermembers=$numbersmembers[users];
$blah = $numbermembers / $numperpage;
$temp2 = intval($blah);
if ($numperpage!=1) {
$temp2 += 1;
}
if (($numbermembers % $numperpage)==0) {
$temp2 -= 2;
}
$temp3 = 1;
while ($temp3 <= $temp2) {
$thisstart = (($temp3 - 1) * $numperpage) + 2;
$thisstart2 = $thisstart - 1;
if ($thisstart==2) {
$thisstart = 1;
} #end if 0
if ((($thisstart==1) && ($limitstart==0)) || ($thisstart2==$limitstart)) {
$memberlistpages .= "$temp3 \n";
} else {
$memberlistpages .= "<a href=\"memberlist.php?action=$action&limitnumber=$limitnumber&limitstart=$thisstart&numperpage=$numperpage2&orderby=$orderby&ausername=$ausername&homepage=$homepage&icq=$icq&aim=$aim&yahoo=$yahoo&biography=$biography&joindateafter=$joindateafter&joindatebefore=$joindatebefore&lastvisitafter=$lastvisitafter&lastvisitbefore=$lastvisitbefore&lastpostafter=$lastpostafter&lastpostbefore=$lastpostbefore&postslower=$postslower&postsupper=$postsupper&direction=$direction\">$temp3</a> \n";
} #end if
$temp3++;
} #end while
} else {
$memberlistpages = "Page: 1";
} #end if ($top!="true)
eval("echo dovars(\"".gettemplate("memberlist")."\");");
} #end if ($action=="getall")
if ($action=="search") {
$cssinclude = gettemplate("cssinclude");
eval("echo dovars(\"".gettemplate("memberlistsearch")."\");");
} #end if ($action=="search")
?>
//TOP POSTERS AMOUNT $topposternum = 10; and // NUMBER OF RECORDS PER PAGE $numperpage = 30; ----- Now, I know some of this code isn't real efficient -- I did somethings, forgot I did them, then compensated in other places. Anyway, hopefully I'll be able to release some updates.Enjoy! Give me feedback please! ![]() [Edited by Ed Sullivan on 04-20-2000 at 03:38 PM] [Edited by Ed Sullivan on 04-20-2000 at 05:28 PM] [Edited by Ed Sullivan on 04-21-2000 at 09:37 PM] Show Your Support
|
|||||||||||||||||||||||||
| Comments |
|
#2
|
|||
|
|||
I just realized the AIM javascript doesn't work. I looked at it and didn't really see anything wrong. Now, I'm not real good at javascript, so if someone could take a look at it, that'd be great! ![]() [edit: I fixed this too!! ][Edited by Ed Sullivan on 04-20-2000 at 05:29 PM] |
|
#3
|
|||
|
|||
|
Dammit! I just accidently killed another feature -- the paging doesn't work on any page other than the first. *sigh*
[edit: I fixed this feature and changed the line of code up there --^] [Edited by Ed Sullivan on 04-20-2000 at 03:39 PM] |
|
#4
|
|||
|
|||
|
Well done - I have not tried it yet, but I'm sure it will be good. As hacks come in, I will try to include a template-ised version of it in the next major release - accredited to the author of course. BTW, how much of that code did you borrow from the control panel
![]() Keep 'em coming, John |
|
#5
|
|||
|
|||
|
Control panel? What control panel?
![]() I borrowed entirely too much -- but hey, if its there for ya, why not use it
|
|
#6
|
|||
|
|||
|
LOL
![]() I like the hack very much ![]() a great job sofar. It looks alot cleaner then the ubb one, I must say |
|
#7
|
|||
|
|||
|
Quote:
|
|
#8
|
|||
|
|||
|
Quote:
I will edit the code above, but here are the directions for templates.Create template memberlist - Code:
{htmldoctype}
<html><head><title>Members List</title>
$cssinclude
<script language="javascript">
<!--
function aimwindow(aimid) {
window.open("member.php?action=aimmessage&aim="+aimid,"_blank","toolbar=no,location=no,menubar=no,scrollbars=no,width=175,height=275,resizeable=yes,status=no")
}
// -->
</script></head><BODY>
<table border=0 width=99% cellspacing=1 cellpadding=3>
<tr>
<td align="left"><a href="index.php"><img src="$titleimage" border=0></a></td><td align="center" width=225> <b><largefont>Members List</b></largefont> <BR>
<center><smallfont><a href="memberlist.php?action=search">advanced search</a> |
<a href="memberlist.php?action=getall&orderby=posts&direction=DESC&numperpage=10&top=true">top 10 posters</a> |
<a href="memberlist.php">alphabetical</a> |
<a href="memberlist.php?action=getall&orderby=joindate&direction=DESC">date joined</a></smallfont></td>
</tr>
</table><br><table border=0 width=99% cellspacing=1 cellpadding=3>
<tr>
<td align="center"><font face="Arial" size=2><B>User Name</B></font></td>
<td align="center"><font face="Arial" size=2><B>ICQ</b></font></td>
<td align="center"><font face="Arial" size=2><B>AIM</b></font></td>
<td align="center"><font face="Arial" size=2><B>Yahoo!</b></font></td>
<td align="center"><font face="Arial" size=2><B>Biography</b></font></td>
<td width=68 align="center"><font face="Arial" size=2><B>Join Date</b></font></td>
<td align="center"><font face="Arial" size=2><B>Posts</b></font></td>
</tr>
$memberlistbit
</table>
<div align="right"><smallfont>Page: $memberlistpages</smallfont></div>
</body>
</html>
Code:
<tr>
<td bgcolor="{firstaltcolor}"><font face="Arial" size=2><a href="member.php?action=getinfo&userid=$userid">$username</a></font></td>\n<td bgcolor="{secondaltcolor}" align="center">$icqM</td>
<td bgcolor="{firstaltcolor}" align="center">$aimM</td>
<td bgcolor="{secondaltcolor}" align="center">$yahooM</td>
<td bgcolor="{firstaltcolor}"><font face="Arial" size=2>$bio</font></td>
<td bgcolor="{secondaltcolor}" align="center"><font face="Arial" size=2>$joindate</font></td>
<td bgcolor="{firstaltcolor}" align="center"><font face="Arial" size=2>$posts</font></td>
</tr>
Code:
{htmldoctype}
<html>
<head>
<title>Members List - Advanced Search</title>
$cssinclude
</head>
<BODY>
<table border=0 width=99% cellspacing=1 cellpadding=3>
<tr>
<td align="left"><a href="index.php"><img src="images/ubb/bbtitle5v3.jpg" border=0></a></td>
<td align="center" width=225><largefont>Members List</largefont> <BR>
<center>
<smallfont>advanced search | <a href="memberlist.php?action=getall&orderby=posts&direction=DESC&numperpage=10&top=true">top 10 posters</a> | <a href="memberlist.php">alphabetical</a> | <a href="memberlist.php?action=getall&orderby=joindate&direction=DESC">date joined</a></smallfont></td>
</tr>
</table>
<br><form action="memberlist.php" method="post">
<input type="hidden" name="action" value="getall">
<table border=0><tr>
<td><font face="Arial" size=2>User Name contains</font></td>
<td><input type="text" size="35" name="ausername" value=""></td>
</tr>
<tr>
<td><font face="Arial" size=2>and homepage contains</font></td>
<td><input type="text" size="35" name="homepage" value=""></td>
</tr>
<tr>
<td><font face="Arial" size=2>and ICQ Number contains</font></td>
<td><input type="text" size="35" name="icq" value=""></td>
</tr>
<tr>
<td><font face="Arial" size=2>and AIM Handle contains</font></td>
<td><input type="text" size="35" name="aim" value=""></td>
</tr>
<tr>
<td><font face="Arial" size=2>and Yahoo Messenger Handle contains</font></td>
<td><input type="text" size="35" name="yahoo" value=""></td>
</tr>
<tr>
<td><font face="Arial" size=2>and Biography contains</font></td>
<td><input type="text" size="35" name="biography" value=""></td>
</tr>
<tr>
<td><font face="Arial" size=2>and Join Date is after<br>(Format yyyy-mm-dd, leave blank for today)</font></td>
<td><input type="text" size="35" name="joindateafter" value=""></td>
</tr>
<tr>
<td><font face="Arial" size=2>and Join Date is before<br>(Format yyyy-mm-dd, leave blank for today)</font></td>
<td><input type="text" size="35" name="joindatebefore" value=""></td>
</tr>
<tr>
<td><font face="Arial" size=2>and Last Visit is after<br>(Format yyyy-mm-dd hh:mm:ss, leave blank for today)</font></td>
<td><input type="text" size="35" name="lastvisitafter" value=""></td>
</tr>
<tr>
<td><font face="Arial" size=2>and Last Visit is before<br>(Format yyyy-mm-dd hh:mm:ss, leave blank for today)</font></td>
<td><input type="text" size="35" name="lastvisitbefore" value=""></td>
</tr>
<tr>
<td><font face="Arial" size=2>and Last Post is after<br>(Format yyyy-mm-dd hh:mm:ss, leave blank for today)</font></td>
<td><input type="text" size="35" name="lastpostafter" value=""></td>
</tr>
<tr>
<td><font face="Arial" size=2>and Last Post is before<br>(Format yyyy-mm-dd hh:mm:ss, leave blank for today)</font></td>
<td><input type="text" size="35" name="lastpostbefore" value=""></td>
</tr>
<tr>
<td><font face="Arial" size=2>and Number of Posts is greater than</font></td>
<td><input type="text" size="35" name="postslower" value=""></td>
</tr>
<tr>
<td><font face="Arial" size=2>and Number of Posts is less than</font></td>
<td><input type="text" size="35" name="postsupper" value=""></td>
</tr>
<tr><td colspan=2><hr></td></tr>
<tr><td><font face="Arial" size=2>Order by:</font></td><td>
<select name="orderby">
<option selected>username</option>
<option>joindate</option>
<option>lastpost</option>
<option>posts</option>
</select>
<select name="direction">
<option value="">in ascending order</option>
<option value="DESC">in descending order</option>
</select>
</td></tr>
<tr>
<td><font face="Arial" size=2>Number of records per page:</font></td>
<td><input type="text" size="35" name="numperpage" value="30"></td>
</tr>
</table>
<div align="center"><center>
<table border="0">
<tr>
<td><p align="center"><input type="submit" name="submit" value="Submit"></p></td>
<td><p align="center"><input type="reset" name="reset" value="Reset"></p></td>
</tr>
</table>
</center></div>
</form>
</body></html>
|
|
#9
|
|||
|
|||
|
but...
the javascript is a killer. People on WebTV have no support for Javascript, nor do Mac people using iCab. Looking at the code, it doesn't seem that it would be too hard to change. ![]() (I prefer the javascript version, personally) |
|
#10
|
|||
|
|||
|
About the javascript: hmm... could I do an OS/Browser check in PHP and change the links like that? Might work.
But how should I make the links them? To the profile? Not links, just display the AIM Name? Hmm.. that brings up another thing, I might want to add a template for AIM, ICQ, and Yahoo!
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|