PDA

View Full Version : last 10 posts in users profile like Wluke has


SgtSling
11-27-2001, 05:07 AM
?
Anyone know how this is done for 2.21?

nafae
11-28-2001, 11:41 PM
i wish i did, thats a good feature

amykhar
11-29-2001, 12:48 AM
It's cake.

in member.php find:


$userinfo[avatarurl]=getavatarurl($userinfo[userid]);
if ($userinfo[avatarurl]=="") {
$userinfo[avatarurl]="images/clear.gif";
}


add after:


$postsArray= $DB_site->query("Select threadid, title from thread where postuserid='$userid ORDER BY threadid LIMIT 10'");
if (!$postsArray)
$recentPosts = "none";
else {
while ($getRecentPosts=$DB_site->fetch_array($postsArray)) {
$recentPosts .="<a href='$bburl/showthread.php?threadid=" . $getRecentPosts[threadid] ."'>$getRecentPosts[title]</a><br>\n";
}
}


Then, simply add the $recentPosts variable in your getinfo template. Formatting is up to you. :D



NOTE: Check the variables and formatting very carefully. I modified something similar that I did on the fly and have not tested this exact code.

SgtSling
12-01-2001, 04:26 AM
this appeared to work.. but for some reason it listed 100 posts.. instead of ten

Also the sort by call

For some reason it posted all the threads started by this user, instead of the last 10 posts

Can you look at this some more?
Thanks :)

amykhar
12-01-2001, 02:06 PM
OOPS. I read it wrong. I thought you wanted the last 10 threads. Posts are:


Select threadid, title from post where userid='$userid' ORDER BY postid DESC LIMIT 10'



Amy

SgtSling
12-01-2001, 04:05 PM
I tired that a few times.. and this is what I got

Database error in vBulletin 2.2.1:

Invalid SQL: Select threadid, title from post where userid='2462' ORDER BY postid DESC LIMIT 10'
mysql error: You have an error in your SQL syntax near ''' at line 1

mysql error number: 1064

Date: Saturday 01st of December 2001 01:03:03 PM
Script: http://www.dlrarmy.com/forums/forums/member.php?action=getinfo&userid=2462
Referer: http://www.dlrarmy.com/forums/index.php?



I am using this code

$postsArray= $DB_site->query("Select threadid, title from post where userid='$userid' ORDER BY postid DESC LIMIT 10'");
if (!$postsArray)
$recentPosts = "none";
else {
while ($getRecentPosts=$DB_site->fetch_array($postsArray)) {
$recentPosts .="<a href='$bburl/showthread.php?threadid=" . $getRecentPosts[threadid] ."'>$getRecentPosts[title]</a><br>\n";
}
}

amykhar
12-01-2001, 04:22 PM
Let me get back to you on this one. The version of my board didn't have to worry about viewing permissions, etc. because I restricted it to a given set of forums.

Amy

SgtSling
12-01-2001, 04:49 PM
thanks!

Please do!

amykhar
12-01-2001, 05:59 PM
<a href="https://vborg.vbsupport.ru/showthread.php?s=&threadid=32852" target="_blank">https://vborg.vbsupport.ru/showt...threadid=32852</a>