View Full Version : Last post on forum home, working version
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:
if ($goto=="nextnewest") {
replace it with:
// 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:
<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.
ok.. another little bug discovered... and fixed.
in forum/postings.php, find:
updateforumcount($threadinfo[forumid]);
if ($visible) {
replace it with:
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.
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..
ok, in postings.php, under "start do delete thread", i added this way the 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.
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.
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! :)
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
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:
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='".addslashes($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='".addslashes($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.
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.
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:
ALTER TABLE forum ADD lasticon SMALLINT(5) NOT NULL AFTER lastthread;
File: FORUM/admin/functions.php
Find:
$lastpost=0;
$lastthread='';
$lastposter='';
Add after that:
$lasticon='';
Find:
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:
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:
$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:
$posticon=$DB_site->query_first("SELECT iconid FROM post WHERE dateline='$lastposts[lastpost]' AND username='$lastposts[lastposter]'");
$lasticon=$posticon['iconid'];
Find:
$lastpostquery=",lastpost='$lastpost',lastthread='".addslashes($lastthread)."',lastposter='".addslashes($lastposter)."'";
Replace with:
$lastpostquery=",lastpost='$lastpost',lastthread='".addslashes($lastthread)."',lasticon='$lasticon',lastposter='".addslashes($lastposter)."'";
File: FORUM/index.php
Find:
if (strlen($forum['lastthread']) > $maxchars) {
$forum['lastthread'] = substr($forum['lastthread'], 0, $maxchars-2) . '...';
}
Add after that:
if ($forum['lasticon']) {
$icon="<img src=\"$forum[iconpath]\" alt=\"$forum[icontitle]\" width=\"15\" height=\"15\" border=\"0\">";
} else {
$icon="";
}
Find:
//Forum info
$forums=$DB_site->query('SELECT * FROM forum WHERE displayorder<>0 AND active=1 ORDER BY parentid,displayorder');
Replace with:
//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:
if (strlen($forum['lastthread']) > $maxchars) {
$forum['lastthread'] = substr($forum['lastthread'], 0, $maxchars-2) . '...';
}
Add after that:
if ($forum['lasticon']) {
$icon="<img src=\"$forum[iconpath]\" alt=\"$forum[icontitle]\" width=\"15\" height=\"15\" border=\"0\">";
} else {
$icon="";
}
Find:
//Forum info
$forums=$DB_site->query('SELECT * FROM forum WHERE displayorder<>0 AND active=1 ORDER BY parentid,displayorder');
Replace with:
//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:
//create new thread
if ($postpoll) {
$visible = 0;
$DB_site->query("UPDATE forum SET lastthread='".addslashes(htmlspecialchars($subject))."' WHERE forumid IN ($foruminfo[parentlist])");
}
Replace with:
//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:
// 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:
// 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:
// 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:
// 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:
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:
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:
$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:
$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:
<a href="showthread.php?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]">$forum[lastthread]</a>
Change to:
$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.
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:
//create new thread
if ($postpoll) {
$visible = 0;
replace it with:
//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 (https://vborg.vbsupport.ru/attachment.php?s=&postid=297418).
Question: How many queries does this add to forumhome?
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.
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..
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.
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..
I don't have enough time to read through all 19 pages, maybe someone can tell me straight away...how can I make it so clicking the title takes you to the thread, and not the last post in that forum?
ForYou
10-02-2002, 07:37 AM
Hello ..
I'm use 2.2.8 and i have install the last title hack and evry thing is good without any problems .. and now i have problem with it
when i need to put reply on any topic in my forum the last title will not show on forum home but if i reply with subject and icon the icon will appear (show) on forum home without the title ..
please help me for that and sorry for my english ...
Regards
Kars10
10-11-2002, 05:32 PM
This hack rules!!
Wonder? Bevor installation i´ve had 24 Querys on Forumhome now after the installation ive got 23...??
/me loves it and klicks install!
Mystic Gohan
10-12-2002, 12:38 AM
can you show me how to do the little .............. thing so that it doesnt mess with my forum lenths and makes it not strech out
pgowder
10-16-2002, 07:12 PM
I installed the hack on my forums running v2.2.8. Here is the error I get:
Database error in vBulletin Control Panel 2.2.8:
Invalid SQL: SELECT * FROM thread WHERE forumid='33' AND lastposter='Smokin' Ace' AND lastpost='1034790242'
mysql error: You have an error in your SQL syntax near 'Ace' AND lastpost='1034790242'' at line 1
mysql error number: 1064
Date: Wednesday 16th of October 2002 04:26:52 PM
Script: http://www.powwows.com/gathering/gathering/admin/misc.php
Referer: http://www.powwows.com/gathering/admin/misc.php?action=chooser
I believe it might be having problems with a user that's username is Smokin' Ace because of the ' in the username. How can I fix that?
Thanks
Maybe you can post in that forum, so your username is shown then try again...?
pgowder
10-16-2002, 07:17 PM
But won't it give an error next time she posts?
Was that error message created while hacking or does it come up when she posts?
pgowder
10-16-2002, 07:29 PM
Sorry, I should have said that I get this error while running forum update.
Thanks
NTLDR
10-16-2002, 07:30 PM
Change:
$threadtitle=$DB_site->fetch_array($DB_site->query("SELECT * FROM thread WHERE forumid='$forumid' AND lastposter='$getchildforum[lastposter]' AND lastpost='$getchildforum[lastpost]'"));
To:
$threadtitle=$DB_site->fetch_array($DB_site->query("SELECT * FROM thread WHERE forumid='$forumid' AND lastposter='".addslashes(htmlspecialchars($getchildforum[lastposter]))."' AND lastpost='$getchildforum[lastpost]'"));
That should fix the problem.
pgowder
10-16-2002, 07:33 PM
Which file does that change go in?
NTLDR
10-16-2002, 07:36 PM
admin/functions.php You need tyo replace whats in the text file with the change I made above so it should work.
pgowder
10-16-2002, 07:36 PM
I found it, and that fixed it.
Thanks for the quick responses!!
NTLDR
10-16-2002, 07:38 PM
No problem, happy to help :D
Erwin
10-19-2002, 09:15 PM
Bug: If the parent forum is NOT private, but the child forum IS private, the last title appears to show up for members who have no access to the private child forum.
Is there a fix for this? Thanks in advance. :)
@Erwin, I also noticed this problem + this one:
When a thread is the latest thread and its title is shown on forumhome, and I edit the thread's title, and go back to forumhome, it still shows the old thread title, and not the new one...my guess is maybe modifying editpost so when the thread title is changed, it changes it in the DB?
i ave v-bulletin 2.2.8 running and i tried adding this hack but this is what i got ....
i went through the entire thread but no luck :(
Parse error: parse error, expecting `']'' in /home/123.com/httpdocs/forums/index.php(321) : eval()'d code on line 6
Parse error: parse error, expecting `']'' in /home/123.com/httpdocs/forums/index.php(321) : eval()'d code on line 6
===============================
line 321 is this
eval("\$forum['lastpostinfo'] = \"".gettemplate('forumhome_lastpostby')."\";");
According to instructions i am suppose to add this
<a
href="showthread.php?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]">$forum[lastthread]</a> to the 'forumhome_lastpostby'
any suggestions ....
thankx for helping
It is telling you to add that HTML into the TEMPLATE forumhome_lastpostby not in the code ;)
CtrlAltDel
11-25-2002, 10:39 PM
I installed this hack and the thread names rarely update on the homepage at all. I have tried a few fixes in this thread but they dont seem to work, 2.2.8, etc. I'm going to look at the file tek posted, but atm its not working right.
CtrlAltDel
11-25-2002, 10:48 PM
its the newreply code i think
as the newpost code works fine
CtrlAltDel
11-25-2002, 11:09 PM
hmm seemed to have fixed it
musta missed a line :D
+-----------------------------------------------+
| File: FORUM/postings.php (1 change) |
+-----------------------------------------------+
| 1. Find this code:
+--------------------------------------------------------------------------+
updateforumcount($threadinfo[forumid]);
if ($visible) {
+--------------------------------------------------------------------------+
|
+-----------------------------------------------+
| Replace it with:
+--------------------------------------------------------------------------+
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) {
+--------------------------------------------------------------------------+
I don't have the " if ($visible) {" anywhere underneath any of the "updateforumcount($threadinfo[forumid]);" in the file...
:(
sorry, may be you already talk about, but... how to add lastthread icon for that hack on forumhome?
thanx
Mr. X
12-04-2002, 01:57 AM
^check back a few pages.
I read quickly through each page, but didnt see what I was looking for, at least not quite.
I have a forum where almost every thread has a cuss word in the title. The forum can only be read and posted in for registered users, logged out/unreg users still see the forum in question listed on the index, but when they enter, they wont be able to see any threads.
This hack works great on 2.2.9, have it working on my test installation on my workstation, however I'd really like to know if its possible, to disable the last post for this one forum I have? I know I can change permissions to make it invisible to unregistered users, but I dont want to do that, since the forum still needs to appear in the index. Thanks!
Has anyone figured out how to update the title on forumhome when the thread's title is edited?
...Hmm...ok I just looked in the instructions once again and found this:
lastthread
That's the row that's created in a table in the DB....
My guess is...upon editing a thread, the change is entered somewhere, but the code isn't calling it?
N9ne, use "Update Counters" in your AdminCP ;)
Mr. X, please, can you give me link to message, couse i have not time to search.... please! ;)
M.C.: I could use update counters, but that would mean everytime someone edits a thread's title, I would have to update counters...not practical.
Highlander
12-07-2002, 11:40 AM
hi there.. i just got a little error on my site: http://www.spieleplanet.org/forum
look on the main boards "Spieleplanet Communizty .. there it shows 2x times the last threads.. but only in this forums.. on all others its okay.. please give me an idea!?
thx
influence
12-29-2002, 09:23 PM
+-----------------------------------------------+
| File: FORUM/postings.php (1 change) |
+-----------------------------------------------+
| 1. Find this code:
+--------------------------------------------------------------------------+
updateforumcount($threadinfo[forumid]);
if ($visible) {
+--------------------------------------------------------------------------+
|
+-----------------------------------------------+
| Replace it with:
+--------------------------------------------------------------------------+
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 dont show for me either on vb 2.2.6 for the postings.php file.
when i search for updateforumcount($threadinfo[forumid]); .. about 4 of them comes up without the invisible part.
any help?
Boofo
01-09-2003, 07:58 PM
I just installed this on 2.2.9 but I got an error when I went to update the forum info. This is the error:
Database error in vBulletin Control Panel 2.2.9:
Invalid SQL: SELECT * FROM thread WHERE forumid='10' AND lastposter='Boofo's Babe' AND lastpost='1042060020'
mysql error: You have an error in your SQL syntax near 's Babe' AND lastpost='1042060020'' at line 1
mysql error number: 1064
Date: Thursday 09th of January 2003 09:51:30 PM
Script: http://www.bearfacts2.com/forum/forum/admin/misc.php
Referer: http://www.bearfacts2.com/forum/admin/misc.php
I changed the user name causing this to Boofos Babe without the apostrophe, but it still gives me the error. Can anyone please help me with this as my board is messed up now? :)
Boofo
01-10-2003, 01:13 PM
Ok, I finally got the forum update counters to work by making the last post by someone other than the user with an apostrophe in the name. If they post any last posts in the future, then we are going to run into the problem again. I think it has something to do with adding htmlspecialchars or something like that to the last poster in the hack but I'm not sure where to add that to avoid the db error problem in the future. Can anyone lend a hand on that? Also, I get this error when I click on a last post link from a forum that has only 1 thread and 1 post in it.
No thread specified. If you followed a valid link, please notify the webmaster
It seems if there is more than 1 post in 1 thread, then the link clicks through fine. Anyone have any ideas on how to fix this?
Boofo
01-10-2003, 04:33 PM
Originally posted by TECK
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:
if ($goto=="nextnewest") {
replace it with:
// 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:
<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.
Floren, will the following code do the same thing or do I need to change it to your code above?
open showthread.php and above:
if ($goto=="nextnewest") {
$thread = verifyid("thread",$threadid,1,1);
add:
// goto newest thread
if ($goto=="newthread") {
if (isset($forumid) and $forumid!=0) {
$foruminfo=verifyid("forum",$forumid,1,1);
$forumid=$foruminfo['forumid'];
$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;
}
}
In the "forumhome_lastpostby" template:
change:
<a href="showthread.php?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]">$forum[lastthread]</a>
to:
<a href="showthread.php?s=$session[sessionhash]&goto=newthread&forumid=$forum[forumid]" title="Go to first post">$forum[lastthread]</a>
Boofo
01-28-2003, 03:19 AM
Is anyone still supporting this hack? I finally got it working ok, but I ran into a problem earlier tonight. I got the
No thread specified. If you followed a valid link, please notify the webmaster
error again while clicking on the last title link on one of the forums on the forumhome. When I ran the update counters for the threads and then the forums, the link was clickable again. Does anyone have any idea what would cause this to happen? The thread in question did have some dashes in the title name, if that means anything.
Boofo
01-30-2003, 08:24 PM
One last time, is anyone supporting this hack?
I found a bug in this hack, say you disallow guests to view threads in a forum, the guest can still see the title on forumhome, what can I do to make it so they only see the last post they're supposed to see?
KevinM
02-11-2003, 05:50 PM
I have installed this hack and it partly works. I have checked the installation and all seems to be as per instructions. I also have a gateway (usenet) hack installed which maybe causing a conflict.
My problem is:
The last post date / name etc are fine
The last post title is incorrect - it was correct the first time but won't update.
The link from the last post title works, and takes you to the last post.
Why won't the title update?
You can see the site at http://www.gardenbanter.co.uk
I hope one of you can help.
Ok - I think I've figured it out. As all my threads come from usenet, the gateway script imports them into the db. Therefore after each import, the 'update forums info' needs to be run. In my case this is 6 times every hour. I have written a cron job calling the misc.php file. It seems to be working, but don't know what it will mean to the server load.
webhost
02-17-2003, 11:01 PM
have the same problem using 2.2.9 Hack was working then I installed this hack https://vborg.vbsupport.ru/showthread.php?s=&threadid=34361 now when someone registers it puts the info for that user in the post but does not update on forumhome page. I can go and run update counters in admin cp and it updates then. Any ideas.?
maxxxxxx
02-19-2003, 10:47 AM
All works great but i want this last post on left side under the forums list like the picture...
http://www.phonecity.de/lastpost.gif
thx and cu
maxxxxxx
maxxxxxx
02-19-2003, 01:03 PM
Originally posted by Omero
I've tried to edit the code to make the title NOT appear for all forums where the user don't have access to, copying a couple of lines from forumdisplay.php (I'm no hacker, i'm simply a user, and know very little of PHP).
It works perfectly for me (but TEST IT AT YOUR OWN RISK, im no php coder :D), but:
A) I'm sure there is a better way to implement it... i RECHECK permissions, while probably permissions are already checked and i should just pull them out from the right variable... but i dont know how :)
B) I'm not sure at all if the title will display or not, in the case
Category
- Private subforum
- Non private subforum
I think this mini edit i did just remove the title in the case the forum is VISIBLE from homepage, and NOT in the case the title is in a category visibile, but comes from a private subforum you shouldnt have access to (that's because i simply check if the user can enter the forum, and display nothing if he can't... the user can access that category, so the title is shown, even if the title comes from a "non accessible for the user" forum :)
Yet, it works, it doesn't show the title for the forums you don't have access to :) I tested it, but USE IT AT YOUR OWN RISK.
// Last post hack + check for view
$titleperm=getpermissions($forumid,-1,-1,$foruminfo['parentlist']);
if ($titleperm[canview]) {
$showtitle=1;
}
if ($showtitle) {
$forum['lasttitle']=unhtmlspecialchars($forum['lasttitle']);
if (strlen($forum['lasttitle']) > 25) {
$forum['lasttitle'] = substr($forum['lasttitle'], 0, 23);
$forum['lasttitle'] .= '..';
}
} else {
$forum['lasttitle']='';
}
Hello... at wich plase i must paste with code in.... sorry my english is not the best and i dont understand all that you write...
Best regards
maxxxxxx
Boofo
03-02-2003, 08:05 PM
Sometimes when I click on the last title on the forum home I get the dreaded no thread specified error. I have narrowed it down to this piece of code (which is an addon to this hack posted by PPN elsewhere in this thread).
// 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($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 to replace in the "forumhome_lastpostby" template:
<a href="showthread.php?s=$session[sessionhash]&goto=newthread&forumid=$forum[forumid]" title="Go to first post">$forum[lastthread]</a>
Can anyone please tell me why the threadid will not update at times? If I go into the Admin CP and use the update counters, then it works fine.
MetroSports82
03-02-2003, 08:44 PM
I've actually come really close to fixing that very issue. but unfortunately, i only had it working for some usergroups, while it was not updating for the others, is this the same problem your having? i'm using v2.2.9.
Metro.
Boofo
03-02-2003, 09:08 PM
I am using 2.2.9, also. I "think" I might have it fixed, but not sure. In the code above, try changing:
$forumid=$foruminfo['forumid'];
to:
$forumid=$threadinfo['forumid'];
and let me know if that fixes it for you.
webhost
03-02-2003, 09:19 PM
What file is that in?
Boofo
03-02-2003, 09:23 PM
The showthread.php, but you must be using the addon by PPN. ;) If anyone can verify this fixes it, I would appreciate it.
webhost
03-03-2003, 08:22 AM
I lloked in showthread php and that is not in the file, could you tell me where the add on is located at
Boofo
03-03-2003, 09:10 AM
That code is the addon. It changes the last title to go to the first post in the thread instead of going to the last post like the arrow already does.
iggemonster
04-01-2003, 06:24 PM
hi !
does this hack work with 2.3.0 ?
greetz
Kianor
04-03-2003, 01:38 PM
i was trying this hack for 2.3.0 but i did't appear to wrk, cause it shows the last title for everyone even if you are not logged in or the forum is a private one.
There's no support for this hack anymore?
Mr. X
04-08-2003, 05:32 AM
I installed this hack on my public forum finally (after an upgrade to 2.3.0) and so far I've had no errors at all, same with my localhost test forum. I wish there was a way to disable lastpost for a forum that only registered members can see, but thats my only gripe. I'd really like to get that icon addon though, so I'll install that tomorrow on my test board and see how it goes.
For my private forum, I have that set that only admins/mods can view it, so it doesnt appear to anyone else, so no problems there.
i've had it working on 2.26/7/8&9 but its not straight forward on 2.3 because $lastposts=$DB_site->query_first("SELECT 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'];
$lastposter=$lastposts['lastposter'];
}
$lastpostquery=",lastpost='$lastpost',lastposter='".addslashes($lastposter)."'"; isnt in v2.3 /functions/admin/functions.php. How did you get your v2.3.0 working? TIA
Boofo
04-08-2003, 04:05 PM
This code was taken straight out of the 2.3.0 functions.php ;)
$lastposts=$DB_site->query_first("SELECT 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'];
$lastposter=$lastposts['lastposter'];
}
$lastpostquery=",lastpost='$lastpost',lastposter='".addslashes($lastposter)."'";
odd ? but thnx, will try again. Yours works ok?
Boofo
04-08-2003, 04:28 PM
I'm using 2.2.9, but I took that straight out of the functions.php for 2.3.0. I little tip...if you can't find a block of code, try looking for a single line of code and check it out for the rest of it. Sometimes the formatting is different which will throw things off.
thnx. Ignore me btw, its all there, works a treat. Not sure what iwas doing b4? :)
Mr. X
04-08-2003, 07:38 PM
"if you can't find a block of code, try looking for a single line of code and check it out for the rest of it. Sometimes the formatting is different which will throw things off."
Yep, thats exactly what I do. Ultraedit's search isnt great, so I just search for the first line, but if its a line that appears a bunch of times in a file, I move to the next and narrow it down, then compare the block of code.
It sucks, wish I could find blocks of code in Ultraedit though.
Boofo
04-08-2003, 07:48 PM
Try EditPlus2. You can find whole blocks of code with it, no matter how big. The one line search is why I ditched Ultra-Edit and switched to EditPlus2. Far better editor. ;)
Mr. X
04-10-2003, 12:10 AM
Hmm yeah I've been looking into it. UE does have alot of stuff I like, but I might consider switching.
Does the Icon addon work? I get alot of lines that dont appear in 2.3.0 code so Im guessing its a no go now. Bummer, an Icon addition would be nice with this hack.
Oblivion Knight
04-16-2003, 10:04 AM
Thanks Scott, it's working flawlessly on 2.3.0 RC3 :)
This is one of those modifications that I believe vBulletin should have as default..
* Oblivion Knight clicks install.
XP Kid 86
04-18-2003, 04:19 PM
hmm odd no matter where i put the <a href="showthread.php?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]">$forum[lastthread]</a>
i cant get it to work .. can you help me out maybe by takin a look at my forum or something .. the hacking went smoothly enough .. im runnin' 2.3.0 .. so can someone please help me this is like a must for a vB
- Speedy
Holidazed
04-22-2003, 02:50 PM
I am getting a parse error when trying to delete in posts.
It says:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Parse error: parse error in /home2/webbhelp/webbhelper-www/mb/postings.php on line 837
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
It does not give any more information. When deleting a post from within the "Edit Post" section, all is cool, but after viewing the thread (showthread.php) and choosing "Delete Thread / Post" from the " Admin Options" menu, it give me the error above.
See for yourself
http://www.dungeonkeepersdomain.com/mb/postings.php
Help
Alien
05-06-2003, 03:55 AM
Just installed this on 2.3.0, and it worked flawlessly SO FAR.
Tested deleting threads (using edit post AS WELL AS deleting directly from the admin options menu inside showthread), moving threads, etc. So far so good...
I'll keep poking around and see if I crash it, heh.
-Jason
Emrys
05-06-2003, 04:27 PM
Installed this and everything seems to work fine. Although I cannot figure out how to get a last post with the 25 characters to be even with a last post with say 15 characters.
In other words, everytime that the script adds the "..."s the title is out of line with the non "..."s posts. Example at : http://www.mac-forums.com.
I have tried to edit the template and changing the length of the string. Nothing has an effect on the alignment. Also tried it with bold and not bold. This one is just messing with me.
Any ideas?
I've noticed some boards don't have this issue, so I know it can be fixed. I just can't remember which ones, and I'm not gonna re-read a 25 page thread. I've already read it twice :)
Added an example for quick reference :)
http://mac-forums.com/images/example.gif
See how the top post is a little left of the red line and the other 2 are right on the redline?
It is easier to see when you are looking at whole page.
Alien
05-07-2003, 05:14 PM
I'd recommend going over the steps again, as that issue does NOT happen on my side of things...?
Anyone else get this problem?
Alien
05-07-2003, 05:22 PM
Wow, I have one site that doesn't have it happen but on my other it certainly does! Hmmmmmmm...
-Jason
Emrys
05-07-2003, 05:49 PM
I've seen the problem on other boards.
I have already installed this hack 3 different times. Still no change.
I am thinking it is the way that it would be placed in the template, but everything I've tried that has anything to do with the template does nothing for me.
Thanks though...
Alien
05-07-2003, 06:05 PM
Okay, I'll see if I spot something that causes this in the code instead...
-Jason
subu1
05-12-2003, 02:20 PM
fine Hack it works on my 2.2.8, but who can i make it, i want to go to the last Posting not to the first Posting in the thread.
thxxx
Austin Dea
05-12-2003, 04:02 PM
05-07-03 at 12:49 PM Emrys said this in Post #347 (https://vborg.vbsupport.ru/showthread.php?postid=392813#post392813)
I've seen the problem on other boards.
I have already installed this hack 3 different times. Still no change.
I am thinking it is the way that it would be placed in the template, but everything I've tried that has anything to do with the template does nothing for me.
Thanks though...
Try messing with your td widths. If it's a little too small, it'll smush the content into the sides.
I know that seems obvious, but that was my problem. More specifically, my lastpost template width was bigger than the td in forum_level2_post, so it was getting smushed. Make sure everything;s the same and see if it fixes it.
Emrys
05-12-2003, 04:10 PM
I don't have any widths specified in the <td>'s.... So I guess everything is the same :)
Austin Dea
05-12-2003, 07:55 PM
I think waht's happening is you have the characters displayed set just right so it doesn't stretch the td, but goes a little into the cellpadding. To fix it you either need to widen that cell or shorten the character's displayed length.
Emrys
05-12-2003, 07:59 PM
Yeah, I shortened it to 25... I will try to bring it down and see what happens... thanks
The Wedge
05-17-2003, 03:37 PM
this hack is great but how do I make the link go to the first post in the thread, not the last. I suck at code, I'm a designer!
Boofo
05-17-2003, 04:41 PM
Today at 11:37 AM The Wedge said this in Post #354 (https://vborg.vbsupport.ru/showthread.php?postid=396200#post396200)
this hack is great but how do I make the link go to the first post in the thread, not the last. I suck at code, I'm a designer!
The answer to your question is in the thread here somewhere. I remember seeing that posted a while back.
Austin Dea
05-17-2003, 05:46 PM
The default hack already does that o_O... Just make sure the forumhome_lastpostby says &goto=$lastpost&forumid=$forum[forumid] in the url.
sonic3d
05-28-2003, 05:37 PM
worked flawlessly.
l8er
sonic
MrNase
06-05-2003, 12:56 PM
*licking install*
cool lil thing...
has anyone found a way to display "today" instead of the today's date? Why should there be 06-05-03, today looks better :)
Raptor
06-12-2003, 04:56 PM
got a problem, 2.3.0 installed and the thread title doesnt appear - anyone know a way around this?
Hi,
I followed the instrucions to the letter.
My problem is this line:
<a href="showthread.php?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]">$forum[lastthread]</a>
Did not redirect to the correct topic. Also, the user name did not get refreshed to the correct poster either.
I'm using vB 2.3.0 and would love to use this hack. Can someone explain to me what to fix?
Thanks in advance
does it work with 2.3.0 ?
TObject
07-20-2003, 04:36 PM
Yes
Fenriz
08-09-2003, 02:50 AM
How I can show smile of the topic?
How to forbid carry of the name of a topic for the second line?
How to expand cell "Last Post" to the size of 25 letters?
Oblivion Knight
08-13-2003, 09:55 AM
Hrm.. Just a small bug is occurring with 2.3.2
If an & is used in the title, this get's displayed as & amp; (without the space) on the forum summary and forum display.
Any fix for this Scott?
Bison
08-20-2003, 05:10 AM
You have to include "special characters" function to the variable in order to remove that ...
LT97B
08-26-2003, 12:02 AM
Nevermind, Im getting good at this. (http://www.prowhite.org)
eLsGn
08-27-2003, 07:27 PM
if i make private section
sections for moderetor or admins
so its private chat
how can i hide the last theared because after i add the hack it show the last theard in all sections
legendarysk8er
09-17-2003, 01:41 AM
Great hack.
/me clicks install.
dookie
09-30-2003, 07:50 AM
Works @ 2.3.2 perfectly.
Thanks
dookie
10-02-2003, 02:26 PM
You have to include "special characters" function to the variable in order to remove that ...
same here. could anybody help with that problem?
coRtALoS
10-26-2003, 04:00 AM
got an error in admin functions so, just backedup and got rid of it
Jakor Sevel
10-30-2003, 10:07 PM
I tried update counter and it gave me this error
Database error in vBulletin Control Panel 2.2.9:
Invalid SQL: UPDATE thread SET lastpost=1067558684,replycount=2,postusername='Hie iHimura', postuserid='86', lastposter='EightDYuber',attach= WHERE threadid=543
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE threadid=543' at line 1
mysql error number: 1064
Date: Thursday 30th of October 2003 07:07:00 PM
Script: http://www.nemxx.net/forums/forums/admin/misc.php
Referer: http://www.nemxx.net/forums/admin/misc.php?
assassingod
10-30-2003, 10:34 PM
Jakor Sevel;
Use this fix:
https://vborg.vbsupport.ru/showthread.php?p=444167#post444167
Jakor Sevel
10-31-2003, 01:48 AM
nope, now it gives me this error
and its admin/misc.php right..
Database error in vBulletin Control Panel 2.2.9:
Invalid SQL: UPDATE thread SET lastpost=1067572008,replycount=2,postusername='Ash uel Malkin', postuserid='82', lastposter='twistedheat',attach=0WHERE threadid=550
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'threadid=550' at line 1
mysql error number: 1064
Date: Thursday 30th of October 2003 10:49:48 PM
Script: http://www.nemxx.net/forums/forums/admin/misc.php
Referer: http://www.nemxx.net/forums/admin/misc.php?action=chooser&
VirtualHogwarts
11-30-2003, 12:43 AM
/me clicks install! I love this THANKS! Why isn't it default? notice it is in vB3 hehe.
ENZcom
11-30-2003, 12:45 AM
Didn't work.
Parse error: parse error, expecting `T_VARIABLE' or `'$'' in functions.php on line 2007
Hoffi
12-01-2003, 05:12 PM
Works great with 2.3.3 *install*
Oblivion Knight
12-24-2003, 08:25 AM
Hrm.. Just a small bug is occurring with 2.3.2
If an & is used in the title, this get's displayed as & amp; (without the space) on the forum summary and forum display.
Any fix for this Scott?Heh, this is fixed automatically in 2.3.3.. Woo.! :D
Fenriz
02-03-2004, 10:05 PM
I really need an icon on the left side of this hack..
Anthony_IGO
02-04-2004, 01:40 AM
Can you start working on a version for VB 2.3.x? I have 2.3.2 and would love to have this hack.
JustAskJulie
03-29-2004, 07:49 PM
This hack works fine on 2.3.4
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.