vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Pulling thread title from query (https://vborg.vbsupport.ru/showthread.php?t=49743)

Boofo 03-07-2003 04:33 AM

Quote:

Originally posted by mr e
so you want the post's title AND the thread's title?
LOL We keep cross-posting here.

Yes, I want to get them both. :)

mr e 03-07-2003 04:40 AM

LOL, ya we are cross posting

ok try this, it's late so it might not be perfect and if it's not i'll fix it tomorrow cuz my bed's calling me :)

PHP Code:

$totalposts=$userinfo[posts];
  if (
$totalposts!=or $userinfo[lastpost]!=0) {
    
$getlastposts=$DB_site->query("SELECT thread.title AS threadtitle,thread.threadid,thread.forumid,post.title AS posttitle,post.postid,post.dateline,post.userid,post.visible FROM thread,post WHERE thread.threadid=post.threadid AND post.userid=$userinfo[userid] AND post.visible=1 ORDER BY post.dateline DESC");
    
$postctr=0;
    
$latestposts="";
    while (
$getlastpost=$DB_site->fetch_array($getlastposts)) {
      
$getperms=getpermissions($getlastpost[forumid],$bbuserinfo[userid],$bbuserinfo[usergroupid]);
      if (
$getperms[canview]==1) {
        
$postdate=vbdate($dateformat,$getlastpost[dateline]);
        
$posttime=vbdate($timeformat,$getlastpost[dateline]);

        
$posttitle=$getlastpost[posttitle]."(Thread: ".$threadtitle.")";
        
$posttitle=censortext($posttitle);
        
$posttitle=htmlspecialchars($posttitle);
        
$posttitle=preg_replace("/(\[)(you)(])/siU"$bbuserinfo[username], $posttitle);
        
$posturl="showthread.php?postid=$getlastpost[postid]#post$getlastpost[postid]"///////// <- Not sure what this is supposed to be, what's with the # sign?

        
$postctr++;
        if (
$postctr==1){
          
$lastpostdate=$postdate;
          
$lastposttime=$posttime;
          
$lastposttitle=$posttitle;
          
$lastposturl=$posturl;
        }
        eval(
"\$latestposts .= \"".gettemplate("getinfo_latestposts")."\";");
        if (
$postctr==$showposts) {
         break;
        }
      }
    }
  } else {
  eval(
"\$latestposts .= \"".gettemplate("getinfo_latestpostsnone")."\";"); 


Boofo 03-07-2003 06:56 AM

Thank you, sir. Works great. With just a few tweaks I got it running smooth. I owe you one. ;)

mr e 03-07-2003 02:39 PM

oh cool :D i guess i can code when im asleep ;)

Falkware 05-10-2003 10:06 PM

How do you then get this into postbit template to display the RE: threadtitle on all replies after the initial threadpost? I've been looking for something like this as well to avoid an empty field in my postbit.

Boofo 05-10-2003 10:14 PM

In newreply.php, find:

PHP Code:

// ############################### start post reply ###############################
if ($HTTP_POST_VARS['action']=="postreply") {

  
// check for subject and message
  
$message=trim($message);
  if (
$message=="") {
    eval(
"standarderror(\"".gettemplate("error_nosubject")."\");");
    exit;
  } 

BELOW it add:

PHP Code:

    if ($postinfo[title]!="") {
    
$title="Re: ".htmlspecialchars($postinfo[title]);
    }
    
$title str_replace("Re: Re: ""Re: "$title); 

Still in newreply.php, find:

PHP Code:

    $title=censortext($title);
    
$message=censortext($message); 

ABOVE it add:

PHP Code:

    if ($title=="") {
    
$title="Re: ".$thread[title];
    } else {
    
$title=$title;
    }
    
$title str_replace("Re: Re: ""Re: "$title); 

If you have the multiple quotes hack installed, there is a couple more places you will need it, too. Let me know if you need that also.

Falkware 05-22-2003 12:28 AM

Thank you..got it working now. Also made it put it in using the quick reply box.

Appreciate the help.

Boofo 05-22-2003 09:54 AM

Quote:

Yesterday at 08:28 PM Falkware said this in Post #17
Thank you..got it working now. Also made it put it in using the quick reply box.

Appreciate the help.

How did you do that?


All times are GMT. The time now is 01:42 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.01026 seconds
  • Memory Usage 1,763KB
  • 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
  • (5)bbcode_php_printable
  • (2)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
  • (8)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