vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Find threads started by user (https://vborg.vbsupport.ru/showthread.php?t=32696)

bira 11-25-2001 10:00 PM

ok, real quicky one: find all threads (note: threads, not posts!) started by X.

Open search.php and find:

Code:

// ###################### Start posts by user x #######################
Above it insert:

Code:

// ###################### Start threads by user x #######################
if ($action=="userthreads") {
  // get allowable forums:
  $forumsql=getallforumsql();

  // get user:
  $usersql=" AND thread.postuserid='$userid'";

  $wheresql="1=1".$forumsql.$usersql;

  if ($getsearch=$DB_site->query_first("SELECT searchid FROM search WHERE query='".addslashes($wheresql)."'")) {
    $searchid=$getsearch[searchid];
  } else {
    // get last search for this user and check floodcheck
    if ($prevsearch=$DB_site->query_first("SELECT searchid,dateline FROM search WHERE ".iif($bbuserinfo[userid]==0,"ipaddress='$ipaddress'","userid=$bbuserinfo[userid]")." ORDER BY dateline DESC LIMIT 1")) {
      if (time()-$prevsearch[dateline]<$searchfloodcheck and $searchfloodcheck!=0) { // and !ismoderator()) {
                                eval("standarderror(\"".gettemplate("error_searchfloodcheck")."\");");
                                exit;
      }
    }
                // insert query into db
                $DB_site->query("INSERT INTO search (searchid,query,dateline,querystring,showposts,userid,ipaddress) VALUES (NULL,'".addslashes($wheresql)."',".time().",'".addslashes($query)."',0,$bbuserinfo[userid],'".addslashes($ipaddress)."')");
                $searchid=$DB_site->insert_id();
  }


  eval("standardredirect(\"".gettemplate("redirect_search")."\",\"search.php?s=$session[sessionhash]&action=showresults&searchid=$searchid\");");
}

That's it, essentially. Now you just need to decide where you want to place the link to this.

For example, If you want it to appear in a user's profile, then place the following link in the getinfo template:

Code:

<a href="search.php?s=$session[sessionhash]&action=userthreads&userid=$userinfo[userid]">Find threads started by $userinfo[username]</a>

squawell 11-26-2001 05:06 AM

it's great!!:)

can show up in postbit template??

bira 11-26-2001 05:13 AM

the link for postbit template is

<a href="search.php?s=$session[sessionhash]&action=userthreads&userid=$post[userid]">View all threads started by $userinfo[username]</a>

Cheers,

Bira

bira 11-26-2001 05:22 AM

Forgot to mention you can view this 'hack' on my bb, at http://www.atlasf1.com/bb (you don't need to be registered in order to view threads or profiles).

I have it added to the user's profile, but also in the first post of a thread (and only there), I have a link "view all threads started by X".

squawell 11-26-2001 05:34 AM

thankz bira!!

i really think this is a good hack for me~~:D

Lesane 11-26-2001 06:53 AM

Nice Hack, thanks Bira.

eva2000 12-17-2001 04:09 PM

late to the party but definitely installing this one :D

bira 12-17-2001 04:38 PM

here's an add-on to this hack, which I have on my bulletin board:

On my BB (and you can see it at http://www.atlasf1.com/bb/index.php ) on the first post of a thread (and only on that post) there is a link "Find more threads started by this user".

If you want to add that, do the following:

This add-on uses the Post Counter hack, so you need to have that installed first (the $post[postcount] version)

1) Create a new template, called postbit_userthreads.

This template should include:

Code:

[high]<a href="search.php?s=$session[sessionhash]&action=userthreads&userid=$post[userid]">[/high]View all threads started by $post[username][high]</a>[/high]
** Note that the text between the highlighted code above can be whatever you want - text, image/button, whatnot.

2) Open showthread.php and find:

Code:

  $post[postcount] = ++$postcount;
  $postbits .= getpostbit($post);

Change it to (addition marked in high):

Code:

  $post[postcount] = ++$postcount;
[high]  if ($post[postcount]=="1") {
        eval("\$post[userthreads] = \"".gettemplate("postbit_userthreads")."\";");
  } else {
        $post[userthreads] = "";
  }[/high]
  $postbits .= getpostbit($post);

3) edit the template postbit, and place $post[userthreads] at the point where you want this link to show.

C'est tu :)

Lesane 12-17-2001 04:58 PM

Thanks for the addon Bira, i gonna add it soon.

Parker Clack 12-18-2001 06:47 PM

Bira:

Great hack yet again. I know I will personally use this a lot. I would really like to see this added to the general search page too.

How is the threadpreview hack working out on your board? I haven't noticed any slow downs at all since installing it.

Parker


All times are GMT. The time now is 10:08 AM.

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.00997 seconds
  • Memory Usage 1,739KB
  • 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
  • (6)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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