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)
-   -   Last post on forum home, working version (https://vborg.vbsupport.ru/showthread.php?t=28561)

Webmasta XT 09-04-2002 11:59 PM

Quote:

Originally posted by Austin Dea
It works fine, but I can't restrict the length so it's messing my tables up.
Can anyone help out there? Restricting the Length of the title?? so it doesn't mess up the tables! :dead:

Webmasta XT 09-05-2002 12:02 AM

works perfect on vb2.2.6

Webmasta XT 09-05-2002 12:11 AM

ok, here..

my problem was resolved!

Find this bit of code in index.php
PHP Code:

$forum['lasttitle'] = substr($forum['lasttitle'], 028); 

the 28 is the number of characters it can display on the title just change that to whatever you want, i changed mine to 15.

Baptizer 09-05-2002 07:34 PM

HMMMM....i think i might have found what i did wrong. I never ran the mysql command:
ALTER TABLE `forum` ADD `lasttitle` VARCHAR(100) NOT NULL AFTER `lastposter`

If i didnt run that commmand what problems should i expect? SO far, when i move a post/or delete a post, it still shows that post title as the recent post. Is this a problem due to not running that command?

rodsterAce 09-06-2002 05:49 AM

VB Portal users: If anyone is intrested I found a way to hide the last post topic titles from private forums using the list of excluded forums in the vbp config file. It works on the forums and index page. email me

king98 09-09-2002 08:16 AM

I am using vb 2.2.5 . it works but only if I delete the last post of the forum (This mean the last titles are updated manually)!. Any one faced such a problem ?
btw, I mad the modifications through the browser, should this be the reason ?

Baptizer 09-09-2002 07:30 PM

I have the same problem...i beleive this code does not support deletions. So if you delete/move something, it will be screwed up for a bit until someone replies/posts a new topic.

TECK 09-09-2002 07:56 PM

i'm posting the new updated version for 2.2.7 in about 15min... :)

TECK 09-09-2002 11:52 PM

Ok, these are the new updated file instructions to install PPN's hack onto VB227...
Now you have the VB3 style onto your VB227. :)

PPN, I hope you dont mind i did this update. If you find it usefull, please place it on your first post, and delete from it the sentence "updated by TECK". For the rest of you, please let me know if you got it up and running using this update. It's working great for me...

eckels2 09-10-2002 11:48 AM

Quote:

Originally posted by TECK
scott, there is a bug in the upgrade...
look at the query with "SELECT MAX(lastpost) AS lastpost,title FROM thread" i realised i cannot mix it. is there a way around?
thanks.

Does this mean that the 2.2.7 update doesn't work right yet?

TECK 09-10-2002 10:37 PM

it's fixed now. make sure when you download the file, at the top it says version 1.1, not 1.0.
if it says 1.0, clear your browser temp files.

for those of you who want to have a link the the thread itself, instead of going to the last post do this:

open showthread.php and find:
Code:

if ($goto=="nextnewest") {
replace it with:
Code:

// goto newest thread
if ($goto=="newthread") {
  if (isset($forumid) and $forumid!=0) {
    $foruminfo=verifyid("forum",$forumid,1,1);
    $forumid=$foruminfo['forumid'];

    $forumslist = "";
    $getchildforums=$DB_site->query("SELECT forumid,parentlist FROM forum WHERE INSTR(CONCAT(',',parentlist,','),',$forumid,')>0");
    while ($getchildforum=$DB_site->fetch_array($getchildforums)) {
      if ($getchildforum[forumid]==$forumid) {
        $parentlist=$getchildforum[parentlist];
      }
      $forumslist.=",$getchildforum[forumid]";
    }

    $thread=$DB_site->query_first("SELECT threadid FROM thread WHERE forumid IN (0$forumslist) AND visible=1 AND (sticky=1 OR sticky=0) AND lastpost>='".($foruminfo[lastpost]-30)."' AND open<>10 ORDER BY lastpost DESC LIMIT 1");
    header("Location: showthread.php?s=$session[sessionhash]&threadid=$thread[threadid]");
    exit;
  }
}

if ($goto=="nextnewest") {

your link to the latest thread will become:
Code:

<a href="showthread.php?s=$session[sessionhash]&goto=newthread&forumid=$forum[forumid]">$forum[lastthread]</a>
scott, let me know if you found the code acceptable on the .txt file. thanks you.

update: i'm gonna look also in postings.php file, it needs to be also modified. for example if you edit a thread title, it wont update the thread... i will look into it and post the mod here...

floren.

TECK 09-11-2002 03:35 PM

ok.. another little bug discovered... and fixed.
in forum/postings.php, find:
Code:

  updateforumcount($threadinfo[forumid]);

  if ($visible) {

replace it with:
Code:

  updateforumcount($threadinfo[forumid]);

  $lastpost=$DB_site->query_first("SELECT * FROM forum WHERE forumid='$threadinfo[forumid]'");
  if($lastpost['lastpost']==$threadinfo['dateline']) {
    $DB_site->query("UPDATE forum SET lastthread='".addslashes(htmlspecialchars($title))."' WHERE forumid='$threadinfo[forumid]'");
  }

  if ($visible) {

that fixes a bug regarding the lastthread update, while you edit the thread (admin options).
if you download the file, make sure it says version 1.2.

TECK 09-12-2002 05:25 AM

now the only problem in postings.php is when you delete a thread, the title is not updated.. i'm working on this as we speak..

TECK 09-12-2002 06:13 AM

ok, in postings.php, under "start do delete thread", i added this way the code:
Code:

  deletethread($threadid,$foruminfo[countposts]);

  $lastpost = $DB_site->query_first("SELECT title,lastpost FROM thread WHERE forumid='$threadinfo[forumid]' ORDER BY lastpost DESC LIMIT 1");
  $DB_site->query("UPDATE forum SET lastthread='".addslashes(htmlspecialchars($lastpost['title']))."' WHERE forumid='$threadinfo[forumid]'");

what do i miss scott?

Scott MacVicar 09-12-2002 06:46 AM

Actually if you just change updateforumcount function to do it, as it gets called when a thread gets moved / deleted

I will write this in my diary to get done tonight just about to go out to work.

TECK 09-12-2002 06:49 AM

thanks alot scott........... :)
wow it was faster then i expected your answer, i pm'ed you to your new lounge, vb.com... hihi :)

Baptizer 09-13-2002 12:33 AM

Teck,
does your 'last post on forum home' display properly when a thread is deleted/moved? just curious.

TECK 09-13-2002 01:24 AM

no. it will be fixed by PPN today, or whenever he can spare some time beside his school.
that's the only part i could not fix. the rest is all working great.

ExAvIoUr 09-13-2002 11:46 PM

just a kind request that PPN or someone post the complete info when it is completed. this thread is making my head spin. :O thanx! :)

TECK 09-14-2002 08:26 AM

hmm, it doesnt make sense scott. the way it is updateforumcount($forumid) function now, it should update it... what did i miss in the steps???
thanks.

Dark Jim 09-14-2002 03:27 PM

When I do update the foruminfo in the admin cp it removes all titles on the forum home. :(

Mystic Gohan 09-15-2002 12:28 PM

Nice hack I installed on my vB but I need to know how to shorten the length if it exceeds so big it will be .......... instead of blabla because big thread names are stretching out my main page

Dark Jim 09-20-2002 10:15 PM

Quote:

Originally posted by Dark Jim
When I do update the foruminfo in the admin cp it removes all titles on the forum home. :(
Uhm and any more updates?

Dark Jim 09-23-2002 08:39 AM

I guess not. I guess I will take a look at it myself but I doubt I can make it work. :ermm:

TECK 09-23-2002 08:53 AM

just be patient, scott is busy. i'm sure he didnt forget.
keep in mind that he's making us a favor that he posts his hacks, like any other hacker here.

Dark Jim 09-23-2002 08:33 PM

Yeah you're right. Btw will you (PPN) also include the posticon addon in the updated version?

ModshackUK 09-25-2002 08:19 PM

I did the hack according to TecK's instructions and I am having the problem where by when a new reply is made to the post it does not update the title of the last posted thread until a new thread is made.

Replying to existing posts does not alter the thread title on forum home.

Can anyone help as its driving me total looney tunes trying to get it to work.

Cheers

HM

Dark Jim 09-26-2002 08:13 PM

TECK, you need to fix your instructions a little.

This:
----------------------------------------
+-----------------------------------------------+
| Replace it with:
+--------------------------------------------------------------------------+
$lastposts=$DB_site->query_first("SELECT MAX(title) as title,MAX(lastpost) AS lastpost FROM thread WHERE forumid=$forumid AND visible=1 AND open<>10");
if ($lastposts['lastpost']>$lastpost) {
$lastposts=$DB_site->query_first("
SELECT lastpost,lastposter
FROM thread
WHERE forumid = $forumid AND lastpost = '$lastposts[lastpost]'");
$lastpost=$lastposts['lastpost'];
$lastthread=$lastposts['title'];
$lastposter=$lastposts['lastposter'];
}

$lastpostquery=",lastpost='$lastpost',lastthread=' ".addslashes($lastthread)."',lastposter='".addslas hes($lastposter)."'";
-----------------------------------

should be:

------------------------------------
+-----------------------------------------------+
| Replace it with:
+--------------------------------------------------------------------------+
$lastposts=$DB_site->query_first("SELECT MAX(title) as title,MAX(lastpost) AS lastpost FROM thread WHERE forumid=$forumid AND visible=1 AND open<>10");
if ($lastposts['lastpost']>$lastpost) {
$lastposts=$DB_site->query_first("
SELECT lastpost,lastposter,title
FROM thread
WHERE forumid = $forumid AND lastpost = '$lastposts[lastpost]'");
$lastpost=$lastposts['lastpost'];
$lastthread=$lastposts['title'];
$lastposter=$lastposts['lastposter'];
}

$lastpostquery=",lastpost='$lastpost',lastthread=' ".addslashes($lastthread)."',lastposter='".addslas hes($lastposter)."'";
----------------------------------------

Now updating works in the admin cp. :)

Dark Jim 09-26-2002 10:35 PM

Hey, could someone help me out getting the posticons to update correctly in the admin cp? I updated the file and added the posticon stuff in it. It seems to work fine when posting but when I do a forum count update all posticons are gone (but titles work with my fix in the post above).

See the attached file.

TECK 09-26-2002 10:46 PM

dark jim, i'm gonna ask you to take out my file and put a file only with your mods.
or even better, to post here using the [code] vb code. thanks.

TECK 09-26-2002 10:58 PM

and you are right about the editing. i missed the title part. thank you.
i'm gonna ask scott to move it on top the file, since it fixed the last bug we all had problems with.

Dark Jim 09-27-2002 09:41 AM

Works with the current version of the lasttitle hack. (Not fully my work, read 2 pages earlier in this topic.) I will (try to) update it everytime PPN/Teck update the last title hack.

Run this query:
PHP Code:

ALTER TABLE forum ADD lasticon SMALLINT(5NOT NULL AFTER lastthread

File: FORUM/admin/functions.php
Find:
PHP Code:

  $lastpost=0;
  
$lastthread='';
  
$lastposter=''

Add after that:
PHP Code:

  $lasticon=''

Find:
PHP Code:

        if($getchildforum[lastthread]=='') {
          
$threadtitle=$DB_site->fetch_array($DB_site->query("SELECT * FROM thread WHERE forumid='$forumid' AND lastposter='$getchildforum[lastposter]' AND lastpost='$getchildforum[lastpost]'"));
          
$lastthread=$threadtitle[title];
        } else {
          
$lastthread=$getchildforum[lastthread];
        } 

Add after that:
PHP Code:

        if($getchildforum[lasticon]=='') {
          
$posticon=$DB_site->query_first("SELECT iconid FROM post WHERE dateline='$threadtitle[lastpost]' AND username='$threadtitle[lastposter]'");
          
$lasticon=$posticon[iconid];
        } else {
          
$lasticon=$getchildforum[lasticon];
        } 

Find:
PHP Code:

  $lastposts=$DB_site->query_first("SELECT MAX(title) as title,MAX(lastpost) AS lastpost FROM thread WHERE forumid=$forumid AND visible=1 AND open<>10");
  if (
$lastposts['lastpost']>$lastpost) {
    
$lastposts=$DB_site->query_first("
      SELECT lastpost,lastposter,title
      FROM thread
      WHERE forumid = 
$forumid AND lastpost = '$lastposts[lastpost]'");
    
$lastpost=$lastposts['lastpost'];
    
$lastthread=$lastposts['title'];
    
$lastposter=$lastposts['lastposter'];
  } 

Add after that:
PHP Code:

  $posticon=$DB_site->query_first("SELECT iconid FROM post WHERE dateline='$lastposts[lastpost]' AND username='$lastposts[lastposter]'");
  
$lasticon=$posticon['iconid']; 

Find:
PHP Code:

$lastpostquery=",lastpost='$lastpost',lastthread='".addslashes($lastthread)."',lastposter='".addslashes($lastposter)."'"

Replace with:
PHP Code:

  $lastpostquery=",lastpost='$lastpost',lastthread='".addslashes($lastthread)."',lasticon='$lasticon',lastposter='".addslashes($lastposter)."'"

File: FORUM/index.php
Find:
PHP Code:

           if (strlen($forum['lastthread']) > $maxchars) {
              
$forum['lastthread'] = substr($forum['lastthread'], 0$maxchars-2) . '...';
            } 

Add after that:
PHP Code:

            if ($forum['lasticon']) {
              
$icon="<img src=\"$forum[iconpath]\" alt=\"$forum[icontitle]\" width=\"15\" height=\"15\" border=\"0\">";
            } else {
              
$icon="";
            } 

Find:
PHP Code:

//Forum info
$forums=$DB_site->query('SELECT * FROM forum WHERE displayorder<>0 AND active=1 ORDER BY parentid,displayorder'); 

Replace with:
PHP Code:

//Forum info
$forums=$DB_site->query('SELECT forum.*,icon.title as icontitle,icon.iconpath as iconpath FROM forum 
LEFT JOIN icon
ON (forum.lasticon=icon.iconid)
WHERE displayorder<>0 AND active=1 ORDER BY parentid,displayorder'
); 

File: FORUM/forumdisplay.php
Find:
PHP Code:

           if (strlen($forum['lastthread']) > $maxchars) {
              
$forum['lastthread'] = substr($forum['lastthread'], 0$maxchars-2) . '...';
            } 

Add after that:
PHP Code:

            if ($forum['lasticon']) {
              
$icon="<img src=\"$forum[iconpath]\" alt=\"$forum[icontitle]\" width=\"15\" height=\"15\" border=\"0\">";
            } else {
              
$icon="";
            } 

Find:
PHP Code:

//Forum info
$forums=$DB_site->query('SELECT * FROM forum WHERE displayorder<>0 AND active=1 ORDER BY parentid,displayorder'); 

Replace with:
PHP Code:

//Forum info
$forums=$DB_site->query('SELECT forum.*,icon.title as icontitle,icon.iconpath as iconpath FROM forum 
LEFT JOIN icon
ON (forum.lasticon=icon.iconid)
WHERE displayorder<>0 AND active=1 ORDER BY parentid,displayorder'
); 

File: FORUM/newthread.php
Find:
PHP Code:

      //create new thread
      
if ($postpoll) {
         
$visible 0;
         
$DB_site->query("UPDATE forum SET lastthread='".addslashes(htmlspecialchars($subject))."' WHERE forumid IN ($foruminfo[parentlist])");
      } 

Replace with:
PHP Code:

      //create new thread
      
if ($postpoll) {
         
$visible 0;
         
$DB_site->query("UPDATE forum SET lastthread='".addslashes(htmlspecialchars($subject))."',lasticon=$iconid WHERE forumid IN ($foruminfo[parentlist])");
      } 

Find:
PHP Code:

      // update forum stuff
      
if ($visible==1) {
        
$DB_site->query("UPDATE forum SET replycount=replycount+1,threadcount=threadcount+1,lastpost='".time()."',lastthread='".addslashes(htmlspecialchars($subject))."',lastposter='".addslashes($postusername)."' WHERE forumid IN ($foruminfo[parentlist])");
      } 

Replace with:
PHP Code:

      // update forum stuff
      
if ($visible==1) {
        
$DB_site->query("UPDATE forum SET replycount=replycount+1,threadcount=threadcount+1,lastpost='".time()."',lastthread='".addslashes(htmlspecialchars($subject))."',lasticon=$iconid,lastposter='".addslashes($postusername)."' WHERE forumid IN ($foruminfo[parentlist])");
      } 

File: FORUM/reply.php
Find:
PHP Code:

      // update forum stuff
      
if ($visible==1) {
        
$DB_site->query("UPDATE forum SET replycount=replycount+1,threadcount=threadcount+1,lastpost='".time()."',lastthread='".addslashes(htmlspecialchars($subject))."',lastposter='".addslashes($postusername)."' WHERE forumid IN ($foruminfo[parentlist])");
      } 

Replace with:
PHP Code:

      // update forum stuff
      
if ($visible==1) {
        
$DB_site->query("UPDATE forum SET replycount=replycount+1,threadcount=threadcount+1,lastpost='".time()."',lastthread='".addslashes(htmlspecialchars($subject))."',lasticon=$iconid,lastposter='".addslashes($postusername)."' WHERE forumid IN ($foruminfo[parentlist])");
      } 

File: FORUM/editpost.php
Find:
PHP Code:

  if ($isfirst and $title!="" and $postinfo[dateline]+$editthreadtitlelimit*60>time()) {
    
$DB_site->query("UPDATE thread SET title='".addslashes(htmlspecialchars($title))."', iconid=".intval($iconid)." WHERE threadid=$threadinfo[threadid]");
    
$lastpost=$DB_site->query_first("SELECT * FROM forum WHERE forumid=$threadinfo[forumid]");
    if(
$lastpost['lastpost']==$threadinfo['dateline']) {
      
$DB_site->query("UPDATE forum SET lastthread='".addslashes(htmlspecialchars($title))."' WHERE forumid=$threadinfo[forumid]");
    }
  } 

Replace with:
PHP Code:

  if ($isfirst and $title!="" and $postinfo[dateline]+$editthreadtitlelimit*60>time()) {
    
$DB_site->query("UPDATE thread SET title='".addslashes(htmlspecialchars($title))."', iconid=".intval($iconid)." WHERE threadid=$threadinfo[threadid]");
    
$lastpost=$DB_site->query_first("SELECT * FROM forum WHERE forumid=$threadinfo[forumid]");
    if(
$lastpost['lastpost']==$threadinfo['dateline']) {
      
$DB_site->query("UPDATE forum SET lastthread='".addslashes(htmlspecialchars($title))."',lasticon=$iconid WHERE forumid=$threadinfo[forumid]");
    }
  } 

File: FORUM/postings.php
Find:
PHP Code:

  $lastpost=$DB_site->query_first("SELECT * FROM forum WHERE forumid='$threadinfo[forumid]'");
  if(
$lastpost['lastpost']==$threadinfo['dateline']) {
    
$DB_site->query("UPDATE forum SET lastthread='".addslashes(htmlspecialchars($title))."' WHERE forumid='$threadinfo[forumid]'");
  } 

Replace with:
PHP Code:

  $lastpost=$DB_site->query_first("SELECT * FROM forum WHERE forumid='$threadinfo[forumid]'");
  if(
$lastpost['lastpost']==$threadinfo['dateline']) {
    
$DB_site->query("UPDATE forum SET lastthread='".addslashes(htmlspecialchars($title))."' WHERE forumid='$threadinfo[forumid]'");
  } 

Template: forumhome_lastpostby
Find:
Code:

<a href="showthread.php?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]">$forum[lastthread]</a>
Change to:
Code:

$icon <a href="showthread.php?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]">$forum[lastthread]</a>
It works however updating the forums in the admin cp is very slow. Could someone tell me how to fix this?

Scott MacVicar 09-27-2002 09:49 AM

If i could find your file ;)

its slow as your adding an extra query per forum so when it tries to update them it will take ages.

TECK 09-28-2002 04:21 AM

i noticed another bug. when i post a poll, it will not update the title on forumhome.
to fix it, open newthread.php and find:
Code:

      //create new thread
      if ($postpoll) {
        $visible = 0;

replace it with:
Code:

      //create new thread
      if ($postpoll) {
        $visible = 0;
        $DB_site->query("UPDATE forum SET lastthread='".addslashes(htmlspecialchars($subject))."' WHERE forumid IN ($foruminfo[parentlist])");

download the full 2.2.8 update here.

N9ne 09-28-2002 08:35 PM

Question: How many queries does this add to forumhome?

TECK 09-28-2002 09:19 PM

none. that's why i install it.
my goal on my board is to have a low query number, is the most important for the speed and performance of the site.

N9ne 09-28-2002 09:32 PM

That's my goal too! Is there a way I can contact you via MSN or AIM? I'd love to know, if it's ok with you how you keep your queries down...

I'm glad this doesn't add ANY queries at all!

I need some help cutting queries down in some files..

TECK 09-29-2002 12:48 AM

sorry, i dont do support over IM's. that's why we have forums.

Scott MacVicar 09-29-2002 01:27 PM

You'll find that as long as you dont go adding too many features or the author provides a way to combine queries you will have efficent code.

But please dont think that more queries means a slower execution time, it all depends on how big the table is, indexes, how many tables there is and what your scanning for.

N9ne 09-29-2002 07:13 PM

Yeah, well on my proper forums right now, I went over the top with hacks [60+ of them] and it slowed the forums down, had 46 queries on forumhome etc..


All times are GMT. The time now is 06:28 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.01970 seconds
  • Memory Usage 1,947KB
  • 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
  • (10)bbcode_code_printable
  • (28)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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