Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Pulling thread title from query Details »»
Pulling thread title from query
Version: , by Boofo Boofo is offline
Developer Last Online: Jun 2012 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 03-07-2003 Last Update: Never Installs: 0
 
No support by the author.

What I'm trying to do with the code below is pull both the post title (if there is one) and the thread title from the getlastposts query. What I want it to do is is show "Re: threadtitle" is there is no post title. Can someone please tell me what I am doing wrong?

PHP Code:
$totalposts=$userinfo[posts];
  if (
$totalposts!=or $userinfo[lastpost]!=0) {
    
$getlastposts=$DB_site->query("SELECT thread.title,thread.threadid,thread.forumid,post.title,postid,post.dateline FROM post,thread 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[title];
        
$posttitle=censortext($posttitle);
        
$posttitle=htmlspecialchars($posttitle);
        
$posttitle=preg_replace("/(\[)(you)(])/siU"$bbuserinfo[username], $posttitle);
        
$threadtitle=$getlastpost[title];
        
$threadtitle=censortext($threadtitle);
        
$threadtitle=htmlspecialchars($threadtitle);
        
$threadtitle=preg_replace("/(\[)(you)(])/siU"$bbuserinfo[username], $threadtitle);
        
$posturl="showthread.php?postid=$getlastpost[postid]#post$getlastpost[postid]";
        
$postctr++;
        if (
$postctr==1){
          
$lastpostdate=$postdate;
          
$lastposttime=$posttime;
          
$lastposttitle=$posttitle;
          
$lastposturl=$posturl;
        }
        eval(
"\$latestposts .= \"".gettemplate("getinfo_latestposts")."\";"); 

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 03-07-2003, 04:33 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #13  
Old 03-07-2003, 04:40 AM
mr e's Avatar
mr e mr e is offline
 
Join Date: Dec 2001
Posts: 461
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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")."\";"); 
Reply With Quote
  #14  
Old 03-07-2003, 06:56 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you, sir. Works great. With just a few tweaks I got it running smooth. I owe you one.
Reply With Quote
  #15  
Old 03-07-2003, 02:39 PM
mr e's Avatar
mr e mr e is offline
 
Join Date: Dec 2001
Posts: 461
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

oh cool i guess i can code when im asleep
Reply With Quote
  #16  
Old 05-10-2003, 10:06 PM
Falkware Falkware is offline
 
Join Date: Dec 2001
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #17  
Old 05-10-2003, 10:14 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #18  
Old 05-22-2003, 12:28 AM
Falkware Falkware is offline
 
Join Date: Dec 2001
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

Appreciate the help.
Reply With Quote
  #19  
Old 05-22-2003, 09:54 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:24 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06729 seconds
  • Memory Usage 2,331KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (6)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (8)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete