PDA

View Full Version : Modification of Active Threads


01-08-2001, 10:25 PM
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.

01-09-2001, 12:41 AM
You mean something like at the bottom of:
http://sitepointforums.com/member2.php?action=getinfo&userid=5584

?

01-09-2001, 01:03 AM
Whoa.. I never saw that before luke.. can I have code? ;) Looks very, very cool.

01-09-2001, 01:29 AM
Well let me get it finished and in production so my own members can use it then we'll go from there.

However most of it is a simple reformatting of the default template.

The "What Others Say" is part of my Karma Hack which will be released for 2.0

The only other code I changed was to add support for MSN, Favorite Sites, and increasing the last posts from 1 to 5.

01-09-2001, 01:37 AM
wluke is going to release the Karma hack and that sweet profile upgrade for v2.0 shortly after release of v2.0 (hint hint)

01-09-2001, 01:43 AM
Like what you've done. Mind if I kind of take the idea and "Parkerize" it to my own likings?

01-09-2001, 02:02 AM
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. :)

01-09-2001, 11:51 AM
Holy bananas! You've blown me away! :)

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! :)

01-09-2001, 12:23 PM
Basically all I did was modify the code in the getinfo section of member.php but here is what pulls the posts.


// 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.


$message=$getlastpost[pagetext];
if (strlen($message) > 160) {
$snippet = substr($message,0,160) . " (<a href=\"".$lastposturl."\">more...</a>)<br>";
} else {
$snippet = $message;
}


All you should have to do to use it outside of vB per se is add:
require (global.php)

01-09-2001, 01:04 PM
woah.. i can't wait to see this in vb2 - hopefully the vb2 member profile area looks as good as what you did :)

01-09-2001, 09:00 PM
Do I have to edit some PHP files or just the "getinfo" template? To make it look nicer like you did wluke.

01-09-2001, 09:59 PM
Most of it is simple modification of the getinfo template. I have added new templates to the user record though for some effects and that requires changing files.

Currently the only file you would have to edit is member.php and I am afraid mine looks nothing like the original anymore. When I upgraded from 1.1.4 to 1.1.5 I just copied the 1 modified line from 1.1.5's member.php into my file because it was much easier.

01-09-2001, 10:31 PM
I can provide custom vBulletin Programming and Support for your site.

Could you please help me. I have been having lots of trouble. I think there is something seriously wrong with my computer or something...

01-12-2001, 12:21 AM
Wayne: I tried your code, but unfortunatly it's just not working. I get a blank page. Is there something else I need beforehand?

01-12-2001, 12:23 AM
All it is that I'm really aching for is the query needed to pul the last X number of threads the user has posted in, based on their cookie variable - $bbusername I think it is. Just need the titles and ids pulled out so I can have the link be made of the title of the thread, and have it link to the thread.

Unfortunatly, I'm useless with even semi-complex SQL queries...

01-12-2001, 12:57 AM
Sorry! Nevermind...took awhile but I got it working.