vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Lastpost code (https://vborg.vbsupport.ru/showthread.php?t=50168)

Boofo 03-15-2003 01:13 AM

Lastpost code
 
Can anyone please tell me what would make the following code sometimes give an "thread not specified" error and other times work great? If I update thread counters and then forum counters in the Admin CP, this code works fine. but sometimes if a new message is placed in the thread or a message is moved or deleted, then I start getting the error again on some forums and have to reset the counters to make it work.

PHP Code:

// goto newest thread
if ($goto=="newthread") {
  if (isset(
$forumid) and $forumid!=0) {
    
$foruminfo=verifyid("forum",$forumid,1,1);
    
$forumid=$foruminfo['forumid'];
    
$lastthread=$DB_site->query_first("SELECT threadid FROM post WHERE username='".addslashes(htmlspecialchars($foruminfo[lastposter]))."' AND dateline='$foruminfo[lastpost]'");
//    $lastthread=$DB_site->fetch_array($DB_site->query("SELECT threadid FROM post WHERE username='".addslashes($foruminfo[lastposter])."' AND dateline='$foruminfo[lastpost]'"));
    
header("Location: showthread.php?s=$session[sessionhash]&threadid=$lastthread[threadid]");
    exit;
  }


and here is the line i use to call the post title

Quote:

<a href="showthread.php?s=$session[sessionhash]&goto=newthread&forumid=$forum[forumid]" title="Go to first post">$forum[lastthread]</a>

Erwin 03-15-2003 01:18 AM

It's a known bug that I think was fixed with the latest version of the last title hack released - otherwise, it's a matter of adding pieces of code to the postings.php file etc. manually - instructions are in that thread from memory.

This is because the lastpost column in the table needs to be updated, and you need to do this with other PHP files which affects the lastpost variable.

Boofo 03-15-2003 01:20 AM

I have the latest version installed and I couldn't find anything about it in the thread. Can you lead me to it or let me know what I need to do to fix it, please?

Edit: No fix is in the thread that I haven't already tried. I just re-read the whole thread. The only change is using Teck's newthread code instead of PPN's. Will see if that changes anything. Thanks for all the help. :p

You can close this thread now.


All times are GMT. The time now is 02:11 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.01005 seconds
  • Memory Usage 1,723KB
  • 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
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete