Version: , by (Guest)
Developer Last Online: Jan 1970
Version: Unknown
Rating:
Released: 01-08-2001
Last Update: Never
Installs: 0
No support by the author.
Hi,
Can someone provide some insight for me on how to take the Active Topics hack, and modify it so that, rather than the most recently posted in threads, the most recently posted in threads for the current user is displayed?
Obviously, I just need the code contingent on the person being logged in - I should be able to handle the simple conditional involved assuming the user isn't logged in.
Much thanks.
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
Originally posted by freddie wluke is going to release the Karma hack and that sweet profile upgrade for v2.0 shortly after release of v2.0 (hint hint)
How shortly depends on when I get ahold of the code...
Parker,
I don't mind. I realized that the moment I showed it, people would want to use it themselves. I myself got the idea from screen shots I have seen from Builder, Ebay, Motley Fool and other sites.
However, I might keep a couple of tricks in the bag for SitePoint so what is released might be a little different. But the general feel will be there.
That'd be great, but the idea here was to display links to the X most recent threads a person has posted in: IE...the thread titles and such, not the posts themselves.
I was planning to put something like this on a non-VB page, but unfortunatly am not too good with anything beyond a simple SQL query.
Any help is appreciated, and I'll definintely look forward to that hack!
Basically all I did was modify the code in the getinfo section of member.php but here is what pulls the posts.
Code:
// get last posts
$totalposts=$userinfo[posts];
if ($totalposts!=0 or $userinfo[lastpost]!=0) {
$getlastposts=$DB_site->query("SELECT thread.title,thread.threadid,thread.forumid,postid,post.dateline,pagetext FROM post,thread WHERE thread.threadid=post.threadid AND post.userid=$userid ORDER BY post.dateline DESC");
$postctr=0;
$latestposts="";
while ($getlastpost=$DB_site->fetch_array($getlastposts)) {
$getperms=getpermissions($bbuserid,$bbusergroupid,$getlastpost[forumid]);
if ($getperms[canview]==1) {
$lastpostdate=date($dateformat,$getlastpost[dateline]+(($timeoffset+$bbtimezoneoffset)*3600));
$lastposttime=date($timeformat,$getlastpost[dateline]+(($timeoffset+$bbtimezoneoffset)*3600));
$lastposttitle=$getlastpost[title];
$lastposturl="showthread.php?postid=$getlastpost[postid]#post$getlastpost[postid]";
$message=$getlastpost[pagetext];
if (strlen($message) > 160) {
$snippet = substr($message,0,160) . " (<a href=\"".$lastposturl."\">more...</a>)<br>";
} else {
$snippet = $message;
}
$postctr++;
$latestposts.="<p><a href=\"".$lastposturl."\">".$lastposttitle."</a>??".$lastpostdate." at ".$lastposttime."<br><font face=\"verdana,arial,helvetica\" size=\"1\">".$snippet."</font></p>";
if ($postctr==5) {
break;
}
}
}
} else {
$lastpostdate=$username." has not made any posts yet.";
}
It doesn't pull the whole message unless it is less than 160 characters. Normally it just pulls a snippet. I hadn't made it into templates yet so all the HTML is still in the code. If you don't want to use the snippets then just delete the following lines and remove $snippet from the HTML block.