vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Modification of Active Threads (https://vborg.vbsupport.ru/showthread.php?t=6574)

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.p...fo&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

Quote:

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.

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.

Code:

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


All times are GMT. The time now is 02:43 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01120 seconds
  • Memory Usage 1,737KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete