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

then you'd do something like this

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]";

if (
$posttitle == "") { //only part i changed
$posttitle "Re: $threadtitle";//
}//

        
$postctr++;
        if (
$postctr==1){
          
$lastpostdate=$postdate;
          
$lastposttime=$posttime;
          
$lastposttitle=$posttitle;
          
$lastposturl=$posturl;
        }
        eval(
"\$latestposts .= \"".gettemplate
("getinfo_latestposts")."\";"); 
Reply With Quote
  #3  
Old 03-07-2003, 04:22 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here's what i want to do. I want it to loist like this:

posttitle (Thread: threadtitle)

Will this do this? And how can I get the actual number of posts if a user has less than 10 posts?
Reply With Quote
  #4  
Old 03-07-2003, 04:25 AM
mr e's Avatar
mr e mr e is offline
 
Join Date: Dec 2001
Posts: 461
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

loist?

anyways, so if there is no post title you want the post title to be "Re: $threadtitle" where $threadtitle is the title of the thread?
Reply With Quote
  #5  
Old 03-07-2003, 04:25 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here's the code I am working with now. I took out all the other stuff because it wasn't working.

PHP Code:
  $totalposts=$userinfo[posts];
  if (
$totalposts!=or $userinfo[lastpost]!=0) {
    
$getlastposts=$DB_site->query("SELECT thread.title,thread.threadid,thread.forumid,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);
        
$posturl="showthread.php?postid=$getlastpost[postid]#post$getlastpost[postid]";

if (
$posttitle == "") { //only part i changed
$posttitle "Re: $threadtitle";//
}//

        
$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
  #6  
Old 03-07-2003, 04:27 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
loist?

anyways, so if there is no post title you want the post title to be "Re: $threadtitle" where $threadtitle is the title of the thread?
Yes, sir. I want to have the thtreadtitle after it on all of them, too. I thought I had it once but I got messed up somewhere.
Reply With Quote
  #7  
Old 03-07-2003, 04:29 AM
mr e's Avatar
mr e mr e is offline
 
Join Date: Dec 2001
Posts: 461
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

well i look at the query and you aren't getting the post title, you have thread.title so your $posttitle=$getlastpost[title] is really your thread title

is this out of a php file or did you modify it?
Reply With Quote
  #8  
Old 03-07-2003, 04:30 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
loist?

loist=look

LOL My damned keyboard can't spell.
Reply With Quote
  #9  
Old 03-07-2003, 04:30 AM
mr e's Avatar
mr e mr e is offline
 
Join Date: Dec 2001
Posts: 461
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

so you want the post's title AND the thread's title?
Reply With Quote
  #10  
Old 03-07-2003, 04:31 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
well i look at the query and you aren't getting the post title, you have thread.title so your $posttitle=$getlastpost[title] is really your thread title

is this out of a php file or did you modify it?
It's from an older hack I am updating for my site. How do we get the post title out of that query?
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:29 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.04814 seconds
  • Memory Usage 2,354KB
  • 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
  • (3)bbcode_php
  • (3)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
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)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