PDA

View Full Version : Last post on forum home, working version


Pages : [1] 2

Scott MacVicar
09-20-2001, 10:00 PM
I had tried a version suggested by someone else instead of my own and well, all it did was send the load average up by about 10 times what it was.

This version inserts the last title into the forum database when it is updating the last post name and time. There is no difference in loading time as everything is called normally by vBulletin.

This works on 2.0.x and 2.2.x

Updated at 11:34 GMT on 28th September 2002

Thanks to floren for the latest update.

valid
09-21-2001, 11:09 AM
DEMO? Screenshot?

anything?

Scott MacVicar
09-21-2001, 12:11 PM
ok here is a screen shot

h4p3
09-21-2001, 01:20 PM
PPN, if you move a thread, will it display the correct title? That was the problem in all the other "Last post on forum home" versions.

Scott MacVicar
09-21-2001, 02:07 PM
yes, i just tested it and it worked ok, but for some reason it left the date and last poster the same in the forum it was being moved from, i will have a look at the vB code just now for that reason.

Delete
Merge
Edit
Copy
all work well its just the move one.

h4p3
09-21-2001, 03:12 PM
Yep, many code hackers had this problem, but never solved it ;)

Scott MacVicar
09-21-2001, 03:39 PM
ok delete works, it just doesn' t work if the post being deleted is the only post in the forums.

In an unhacked version it still shows date and name even if the hack is not installed, a bug in vBulletin maybe?

anyway everything works apart from if your delete/moving a thread which is the only one within the forum.

Amasov
09-21-2001, 04:00 PM
After I tried out the other 2 hacks, I thought this one works.

But it doesn't. I'm running 2.0.3 and either I'm gettin' a Parse Error (as you mentioned the variable in your hack "$form['lasttitle']") or nothing appears ($forum[lasttitle]).

What I'm doing wrong ?

Regards,
Chris.

Scott MacVicar
09-21-2001, 04:17 PM
paste in the parse error pls.

the new topics won't take effect until someone posts a reply or new thread.

Amasov
09-21-2001, 04:29 PM
As you stated in your installation textfile

In the control panel go to the "forumhome_lastpostby" template
within it you may add $form['lasttitle'] to show the last thread title to be posted to, i chose the following format for my board.


(I think the parse error occured while the writing ($form('lasttitle) was'nt legal)

I changed it to this:


<table cellpadding="0" cellspacing="0" border="0" width="100%" id="ltlink"><tr align="right">
<td nowrap><smallfont>$forum[lasttitle]<br>$forum[lastpostdate] <font color="{timecolor}">$forum[lastposttime]</font><br>
by <a href="member.php?s=$session[sessionhash]&action=getinfo&find=lastposter&forumid=$forum[forumid]"><b>$forum[lastposter]</b></a></smallfont></td>
<td nowrap>&nbsp;<a href="showthread.php?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]"><img src="{imagesfolder}/lastpost.gif" border="0" alt="Go to last post"></a></td>
</tr></table>


Nothin' happened.
(I think there is nothing in the variable "$forum[lasttitle]" or it's also not legal, therefore nothing appears)

Regards,
Chris.

Scott MacVicar
09-21-2001, 05:38 PM
ok, i discovered what it was, i will re-document in about 20mins after i have had some nice kebab :P

Amasov
09-21-2001, 05:43 PM
Roger, have a nice eating. ;)

Scott MacVicar
09-21-2001, 06:02 PM
ok, i updated the documentation now to go have a beer :P

Amasov
09-21-2001, 06:28 PM
Cheers!:)

Thanks for updating. I'll try it in a few hours.

Thanks.

Regards,
Chris.

inetd
09-22-2001, 12:07 PM
In last post column it is displayed New worm &amp;quot;Ni.. Ni. though original thread title New worm [u]"Nimida"[/u.] Please fix it.
And how to reduce quantity of symbols deduced in the title of a thread?

Scott MacVicar
09-22-2001, 03:10 PM
sorry about this i forgot to unhtmlspecialchars the title.


within index.php and forumdisplay.php look for the follow lines which you added.

if (strlen($forum['lasttitle']) > 30) {
$forum['lasttitle'] = substr($forum['lasttitle'], 0, 28);
$forum['lasttitle'] .= '..';
}

above that add the following
$forum['lasttitle']=unhtmlspecialchars($forum['lasttitle']);

this should solve the problem with the characters not being converted.

Also the decision on length is made by the top code a quick explanation is, if the length is over 30, remove everything after 28 characters and add two dots to the end.

Hope this helps, instruction file now updated.

inetd
09-22-2001, 03:42 PM
Thx, PPN!
GOOD WORK!:)

Scott MacVicar
09-22-2001, 03:45 PM
so this is one of the first versions to work without bringing the server to its knees?

:P

Goddess Washu
09-22-2001, 07:05 PM
Mine works perfectly fine... Although I just combined a bunch of the ones that were posted before, sorta mad my own... don't remember what I did...

Alien
09-23-2001, 09:29 AM
Works great, you did a really good job on this... Thanks so much!

I do have a question though.. How would I get the title to link to the actual post?

Thanks again!. :D

Scott MacVicar
09-23-2001, 09:47 AM
change
$forum[lasttitle]

to

<a href="showthread.php?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]">$forum[lasttitle]</a>

within the "forumhome_lastpostby" template

and didn't you forums use to be UBB?

bbqfan
09-23-2001, 09:56 AM
i have posted the new code of similar hack:
http://www.vbulletin.com/forum/show...&threadid=28489

maybe it interests you... :)

Alien
09-23-2001, 10:10 AM
PPN: Any way to get that to link to the BEGINNING of that particular topic, since the -> arrow already goes to the last *post*?

This possible too?

...and yes, formally UBB.

Scott MacVicar
09-23-2001, 10:40 AM
ok 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='$foruminfo[lastposter]' AND dateline='$foruminfo[lastpost]'"));
header("Location: showthread.php?s=$session[sessionhash]&threadid=$lastthread[threadid]");
exit;
}
}

now change the bit i told you to to
<a href="showthread.php?s=$session[sessionhash]&goto=newthread&forumid=$forum[forumid]">$forum[lasttitle]</a>

sorry it took so long to reply, i thought vBulletin would have had a way to do this, but it didn't so i wrote one.

Alien
09-23-2001, 10:51 AM
Thanks so much!

Hey, what sorta resource difference does it take to run this new link, as opposed to doing it the previous way without the extra query above?

I have over 35 forums.. Want to keep things snappy. :)

Scott MacVicar
09-23-2001, 10:53 AM
none, you are still running one query if you use the current vBulletin equivalent or the one i posted. It should have no adverse effect on the forums.

Alien
09-23-2001, 10:58 AM
Kick ass. :)

Final question (yeah right lol):

Occasionally there is a topic with a quote in it like:

What are "Private Messages"?

For the quotes above, it would only show &quot;

Any way around that? I know it's filtering out junk, was just wondering if it was possible to get quotes back (but only if it does not introduce a security problem.

Thanks again!

Scott MacVicar
09-23-2001, 11:49 AM
i just posted the topic identical to what you used, make sure in index.php that
$forum['lasttitle']=unhtmlspecialchars($forum['lasttitle']); was added when you were pasting information. Either that or I have missed something else out in the hack, which i hope i haven't.

cyrus
09-23-2001, 11:59 AM
[QUOTE]first thing to do is to run this mysql query :P
ALTER TABLE `forum` ADD `lasttitle` VARCHAR(100) NOT NULL AFTER `lastposter`

floleb7
09-23-2001, 01:59 PM
in phpmyadmin

Alien
09-23-2001, 02:23 PM
Hey..

Yeah, I checked my index.php file and it does contain that code below.. I see it is working well on your forum, so it must just be something minor somehow...

Hmmm. :)

Originally posted by PPN
i just posted the topic identical to what you used, make sure in index.php that
$forum['lasttitle']=unhtmlspecialchars($forum['lasttitle']); was added when you were pasting information. Either that or I have missed something else out in the hack, which i hope i haven't.

dxb
11-04-2001, 01:50 AM
PPN any updates for this hack

Scott MacVicar
11-04-2001, 09:42 AM
updated to work with 2.2.0 there was a small difference with the functions.php, it was just a change in the way the query was run, the update file has been updated to accomodate this.

I also adjust what i presumed was the problem that Alien was experiencing.

Thomas P
11-04-2001, 10:27 AM
Hi,

does it let you edit & update the length of the last title through the cp?
Does it support different settings depending on the forum (on/off & length)?
Thanks,
-Tom

dxb
11-04-2001, 11:21 PM
hi there PPN

I just downloaded your file and I cant find this



if ($lastposts['lastpost']) {
if ($lastposts['lastpost']>$lastpost or $lastposts['lastpost']<$currentlastpost) {
$lastposts=$DB_site->query_first("SELECT lastpost,lastposter FROM thread WHERE lastpost='$lastposts[lastpost]'");
$lastpost=$lastposts['lastpost'];
$lastposter=$lastposts['lastposter'];
}
}



the closes i was able to find is



if ($lastposts['lastpost']>$lastpost) {
$lastposts=$DB_site->query_first("SELECT lastpost,lastposter FROM thread WHERE lastpost='$lastposts[lastpost]'");
$lastpost=$lastposts['lastpost'];
$lastposter=$lastposts['lastposter'];
}



and also this query seems to be changed a bit



$DB_site->query("UPDATE forum SET replycount='$numberposts',threadcount='$numberthre ads',lastpost='$lastpost',lastposter='".addslashes(htmlspecialchars($lastposter))."' WHERE forumid='$forumid'");



to this




$DB_site->query("UPDATE forum SET replycount='$numberposts',threadcount='$numberthre ads' $lastpostquery WHERE forumid='$forumid'");




I tried to work on them but with no success :(

Scott MacVicar
11-05-2001, 06:28 AM
Ok instructions updated.


then look for

$lastposts=$DB_site->query_first("SELECT lastpost,lastposter FROM thread WHERE

lastpost='$lastposts[lastpost]'");
$lastpost=$lastposts['lastpost'];
$lastposter=$lastposts['lastposter'];

change to

$lastposts=$DB_site->query_first("SELECT lastpost,lastposter,title FROM thread WHERE

lastpost='$lastposts[lastpost]'");
$lastpost=$lastposts['lastpost'];
$lastposter=$lastposts['lastposter'];
$lasttitle=$lastposts['title'];

-------
FOR VB 2.0.x

on line 1498 look for
$DB_site->query("UPDATE forum SET

replycount='$numberposts',threadcount='$numberthre ads',lastpost='$lastpost',lastposter='".addslashes(htmlspecialc

hars($lastposter))."' WHERE forumid='$forumid'");

change it to

$DB_site->query("UPDATE forum SET

replycount='$numberposts',threadcount='$numberthre ads',lastpost='$lastpost',lastposter='".addslashes(htmlspecialc

hars($lastposter))."',lasttitle='".addslashes($lasttitle)."' WHERE forumid='$forumid'");

FOR VB 2.2.x

look for
if ($lastpost!=$currentlastpost) {
$lastpostquery=",lastpost='$lastpost',lastposter='".addslashes($lastposter)."'";
} else {
$lastpostquery="";
}

change to

if ($lastpost!=$currentlastpost) {


$lastpostquery=",lastpost='$lastpost',lastposter='".addslashes($lastposter)."',lasttitle='".addslashes($lasttitle)."'";
} else {
$lastpostquery="";
}

Thomas P
11-05-2001, 08:54 AM
Originally posted by Thomas P
Hi,

does it let you edit & update the length of the last title through the cp?
Does it support different settings depending on the forum (on/off & length)?
Thanks,
-Tom

I guess this means "no"... well is there any possibility to change the length of the last title appearing?
-Tom

dxb
11-05-2001, 10:35 AM
Sorry PPN I got lost here ... the instruction file in the first post of this hack is still not updated ....

and million thanks for your :)

Scott MacVicar
11-05-2001, 01:49 PM
It won't let me update the file or add a new one i keep getting this error.

Will bring it up to FireFly

Scott MacVicar
11-05-2001, 02:15 PM
yep its been updated, Firefly made sure it was now...

I don't want to post the contents of the file but try making sure its not your cache causing problems.

floleb7
11-06-2001, 02:43 AM
the title of the last post works but now time and date are not showing

Amasov
11-06-2001, 03:33 PM
Here I got another problem:

Some lastpost-thread-descriptions won't be shown.

I used the utility "update counters", but it doesn't works.

What can I do?

Here is a sample:

http://www.d-c-f.de/images/Pictures/lastpostby.jpg

dxb
11-07-2001, 03:13 AM
i just cleared my cache and downloaded the file and named it with a different name and still the file is not updated it's still says 2.0.1

Scott MacVicar
11-07-2001, 03:11 PM
I looked at your forums Amasov and all looks ok now? did it just sort itself?

dxb i can assure you its the new version i've tried it on multiple computers and Firefly to, pm me your email and i'll email you the file then.

Scott

Amasov
11-07-2001, 03:35 PM
Originally posted by PPN
I looked at your forums Amasov and all looks ok now? did it just sort itself?
Scott

Heyho, Scott :)

I just sorted it myself while I was posting in the latest thread and deleted that post. Anyhow, if there was a new post in that described forums, the thread-description was shown. Therefore I made that database-update "by hand".

By now it works perfectly.

Thanks overall. :) :)

Regards,
Chris.

The Realist
11-08-2001, 03:38 PM
Installed as per instructions and got the following error:

Parse error: parse error in /home/sites/home/web/forum/admin/functions.php on line 2254

Warning: Cannot add header information - headers already sent by (output started at /home/sites/home/web/forum/admin/functions.php:2254) in /home/sites/home/web/forum/admin/functions.php on line 1524

Fatal error: Call to undefined function: makelogincode() in /home/sites/home/web/forum/global.php on line 332


Any help?

:(

jamie
11-11-2001, 11:05 AM
yey thanks! :D

i made my own version...but i never could get the right code in functions.php to make it work there:o

one suggestion could you add the last ico too, i already have this included in my version...i just can't code the correct stuff for functions.php to make it work there..ie when updating forums info or after a post is deleted :o

The Realist
11-11-2001, 01:04 PM
Working now but Instructions a little bit confusing.

Were it says:

change to

if ($lastposts['lastpost']) {
if ($lastposts['lastpost']>$lastpost or $lastposts['lastpost']<$currentlastpost) {
$lastposts=$DB_site->query_first("SELECT lastpost,lastposter,title FROM thread WHERE lastpost='$lastposts[lastpost]'");
$lastpost=$lastposts['lastpost'];
$lastposter=$lastposts['lastposter'];
$lasttitle=$lastposts['title'];
}
}

This is not needed at all for 2.2.0 and users of 2.2.0 in fact need:

FOR 2.2.x USE THE FOLLOWING
-----------------------------------
look for
$lastpostquery=",lastpost='$lastpost',lastposter='".addslashes($lastposter)."';

change it to

$lastpostquery=",lastpost='$lastpost',lastposter='".addslashes($lastposter)."', lasttitle='".addslashes($lasttitle)."'";
save the file and upload then continue hack as normal

Can the very first bit " if ($lastposts['lastpost']) { " be deleted and replaced with FOR 2.0.x USE THE FOLLOWING Info.

:)

Scott MacVicar
11-11-2001, 02:04 PM
The
if ($lastposts['lastpost']) {
if ($lastposts['lastpost']>$lastpost or $lastposts['lastpost']<$currentlastpost) {
$lastposts=$DB_site->query_first("SELECT lastpost,lastposter,title FROM thread WHERE lastpost='$lastposts[lastpost]'");
$lastpost=$lastposts['lastpost'];
$lastposter=$lastposts['lastposter'];
$lasttitle=$lastposts['title'];
}
}

part is needed to give $lasttitle some value.

The last bit depends on which version as of 2.2.x they introduced $lastpostquery cause it wasn't needed some times..

The Realist
11-11-2001, 03:08 PM
I could not find the below txt in my version 2.2.0 /admin/functions.php .......

if ($lastposts['lastpost']) {
if ($lastposts['lastpost']>$lastpost or $lastposts['lastpost']<$currentlastpost) {
$lastposts=$DB_site->query_first("SELECT lastpost,lastposter,title FROM thread WHERE lastpost='$lastposts[lastpost]'");
$lastpost=$lastposts['lastpost'];
$lastposter=$lastposts['lastposter'];
$lasttitle=$lastposts['title'];
}
}

So I left it out?

:(

Scott MacVicar
11-11-2001, 03:18 PM
look for

if ($lastposts['lastpost']) {
if ($lastposts['lastpost']>$lastpost or $lastposts['lastpost']<$currentlastpost) {
$lastposts=$DB_site->query_first("SELECT lastpost,lastposter FROM thread WHERE lastpost='$lastposts[lastpost]'");
$lastpost=$lastposts['lastpost'];
$lastposter=$lastposts['lastposter'];
}
}

change to

if ($lastposts['lastpost']) {
if ($lastposts['lastpost']>$lastpost or $lastposts['lastpost']<$currentlastpost) {
$lastposts=$DB_site->query_first("SELECT lastpost,lastposter,title FROM thread WHERE lastpost='$lastposts[lastpost]'");
$lastpost=$lastposts['lastpost'];
$lastposter=$lastposts['lastposter'];
$lasttitle=$lastposts['title'];
}
}

your looking for the above one if you still can't find it your looking for

$lastposts=$DB_site->query_first("SELECT lastpost,lastposter FROM thread WHERE lastpost='$lastposts[lastpost]'");
$lastpost=$lastposts['lastpost'];
$lastposter=$lastposts['lastposter'];

this in specific

The Realist
11-11-2001, 04:01 PM
I cannot find the above, the nearest I can find is the below:

$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 lastpost='$lastposts[lastpost]'");
$lastpost=$lastposts['lastpost'];
$lastposter=$lastposts['lastposter'];
}

:(

Scott MacVicar
11-11-2001, 06:19 PM
ok change the following
if ($lastposts['lastpost']>$lastpost) {
$lastposts=$DB_site->query_first("SELECT lastpost,lastposter FROM thread WHERE lastpost='$lastposts[lastpost]'");
$lastpost=$lastposts['lastpost'];
$lastposter=$lastposts['lastposter'];
}

to

if ($lastposts['lastpost']>$lastpost) {
$lastposts=$DB_site->query_first("SELECT lastpost,lastposter,title FROM thread WHERE lastpost='$lastposts[lastpost]'");
$lastpost=$lastposts['lastpost'];
$lastposter=$lastposts['lastposter'];
$lasttitle=$lastposts['title'];
}

I'll update the documentation with this then

The Realist
11-11-2001, 06:53 PM
Its still has not updated the posts that have already been made. Its working if a member posts a current message but it does not update at all with any old posts.

I have change what you stated above and still no joy?

:)

LuBi
11-12-2001, 01:12 AM
This hack didn't work for me on 2.2 I get the following error.

Parse error: parse error in /www/htdocs/forums/newthread.php on line 375

It's the ?> at the end of the document. I use EditPlus 2 to edit my files, why is it doing this?

dxb
11-12-2001, 05:54 AM
also this may couse a problem


$DB_site->query("UPDATE forum SET replycount='$numberposts',threadcount='$numberthre ads',lastpost='$lastpost',lastposter='".addslashes(htmlspecialchars($lastposter))."' WHERE forumid='$forumid'");


the new function file has the query changed to this


$DB_site->query("UPDATE forum SET replycount='$numberposts',threadcount='$numberthre ads' $lastpostquery WHERE forumid='$forumid'");



you can see the $lastpostquery is added to the query

Scott MacVicar
11-12-2001, 06:20 AM
dxb >
i took that into account and its mentioned within the readme for how to do it to 2.2.x and 2.0.x because of the difference.

Lubi >
does EditPlus have syntax highlighting for PHP? if so then it should show where it went wrong, if not PHPed from http://soysal.com does and is useful for spotting errors.
I honestly don't know what would cause an error like that, you were only updating 3 lines within newreply.php

LuBi
11-12-2001, 06:25 AM
Well I dunno either I do have the sytax colors but the code isn't wrong I think the software must be doing something when I save the file. I've never had this problem with Textpad but I like Editplus 2 way better... I dunno but I can't install any hacks until I get this squared away :eek:

LuBi
11-14-2001, 03:49 AM
How can I make the title of the post/thread a link to the post..? Basically like below... Icon and all...

http://www.suprascene.com/temp/likethis.gif

Ubb style.. Can someone maybe write the template because i don't have the slightest... :confused: thanks ;)

I had it like this on 2.0.3 but I dunno what to do...

mojotim
11-14-2001, 09:46 AM
Hi, great hack.

This typo gave me some problems:
within it you may add $form['lasttitle'] to show

Duh, I should have checked that!

Scott MacVicar
11-14-2001, 03:00 PM
em my bad

:D

LuBi
11-15-2001, 05:49 AM
Well I did the layout myself, but how do I get the code for the icon with the last post? What's the code for the icon?

SharkY-GA
11-15-2001, 06:01 AM
Yeah it would rock if you added the post icon too

h4p3
11-15-2001, 08:31 AM
PPN, this version works really fine on my testboard, some extreme testing, then i will do it on my main forum :)

Javier97Z28
11-15-2001, 02:44 PM
This works great!! Thanks! (first post :) )

Scott MacVicar
11-15-2001, 03:17 PM
Ok, i'll look into doing the post icon as well, I hope i can do it by just adding to the existing query :)

LuBi
11-15-2001, 03:18 PM
Originally posted by PPN
Ok, i'll look into doing the post icon as well, I hope i can do it by just adding to the existing query :)

Thanks!

LuBi
11-15-2001, 10:46 PM
Tried to remove this hack, I uninstalled this hack form all my files backed out changed everything back from what the text told me to change it to. Anyhow so now with my fuctions.php I get this error:

Parse error: parse error in /www/htdocs/forums/admin/functions.php on line 1793

Fatal error: Call to undefined function: makelogincode() in /www/htdocs/forums/global.php on line 332

The code on the lines around it are as follow.


1789 if ($lastpost!=$currentlastpost) {
$lastpostquery=",lastpost='$lastpost',lastposter='".addslashes($lastposter)."';

} else {
$lastpostquery="";
}

$DB_site->query("UPDATE forum SET
replycount='$numberposts',threadcount='$numberthre ads'
1798 $lastpostquery WHERE forumid='$forumid'");


$lastpostquery=""; seems to be the problem, what do I do?

SharkY-GA
11-15-2001, 11:51 PM
Didnt you backup functions.php?

LuBi
11-16-2001, 12:05 AM
Originally posted by SharkY-GA
Didnt you backup functions.php?

Well yes but I installed other hacks after, it should be as simple as un-doing everything to install. But for some reason this hack isn't.... I dunno what the problem is.

LuBi
11-16-2001, 06:17 AM
Well no one has been able to figure out why I get an error removing this hack. So I've decided to keep it, and wait for the icon addon. So I'll KIT waiting for that one, hurry PPN it's a killer.

Scott MacVicar
11-16-2001, 06:25 AM
$lastpostquery=",lastpost='$lastpost',lastposter='".addslashes($lastposter)."';

your missing a " at the end should be

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

inetd
11-20-2001, 09:05 PM
Please, inform the complete working code for vb2.2.1 version.

Scott MacVicar
11-21-2001, 07:07 PM
It will work on vb 2.2.1 there will be no changes as 2.2.1 was just a bug fix and involves no changes to any of the functions which this edits.

Scott

inetd
11-24-2001, 09:56 AM
The last version of the code without bugs is necessary for me. Which works with version 2.2.1. Where it to take?

Syphin
11-24-2001, 10:12 AM
This does work perfectly fine on vb 2.2.1.. Ive been using it sense it was released...

-Syphin

inetd
11-24-2001, 10:31 AM
I understand! The version free from bugs is simply necessary for me!

Alex
11-25-2001, 09:55 AM
does this hack exclude private forums to show last title?

CHeeKY
11-25-2001, 11:45 AM
Question how would this work if you are using access masks ?

Scott MacVicar
11-25-2001, 12:10 PM
The makeforum function already takes into account access masks when showing the last post time and last post user this is simply an addition with last post title so if they don't have permission to view others then they shouldn't see time, user or title.

Scott

danielillo
11-29-2001, 02:02 AM
Does it work with subforums?

Longbow
12-05-2001, 05:35 PM
reported as there is no "lasttitle" field in my forum table.

any hint?

Recon_Boy
12-06-2001, 04:54 AM
First line of the instructions tells you to add that column to the forum table...

Scott MacVicar
12-06-2001, 02:38 PM
danielillo

yes it does as long as you remember to add the code to forumdisplay.php as well as it says in the bottom of the instructions.

h4p3
12-19-2001, 03:37 PM
@PPN

There is still one little Bug. If you make "" in your threadtitle, then it will display (&q ... on the forum home.

I think there should be something enabled, that allows special chars.

floleb7
12-20-2001, 01:20 AM
any news for adding posticon ?

pgowder
12-29-2001, 12:38 AM
I'm getting this error:

Database error in vBulletin 2.2.1:

Invalid SQL: UPDATE user SET lastactivity=1009592618,inforum='19' WHERE userid='2'
mysql error: Incorrect key file for table: 'user'. Try to repair it

mysql error number: 1034

Date: Friday 28th of December 2001 09:23:39 PM
Script: http://www.powwows.com/gathering/gathering/newreply.php
Referer: http://www.powwows.com/gathering/ne...ly&postid=14569

Scott MacVicar
12-29-2001, 12:47 AM
h4p3
-------------
the only problem i noticed is that &nbsp; counts as 6 chracters from the limit so if you have "Something"

it becomes &nbsp;Something&nbsp;

and thats 23 characters so if its limited to 20 characters you will get "Something&nbs shown
it does allow for special characters.

floleb7
-------------
The post icon would really require you adding another field and then adding to the sql query as its not practicle to pull it from the database each time.

pgowder
-------------
My hack doesn't touch anything within that section and it doesn't edit the user table, i'd have a look at other hacks you have installed or try the vBulletin.com support forums

pgowder
12-29-2001, 01:27 PM
It wasn't the hack. It was a problem with a power outage and my database became corrupted.

floleb7
12-29-2001, 06:56 PM
Originally posted by PPN


floleb7
-------------
The post icon would really require you adding another field and then adding to the sql query as its not practicle to pull it from the database each time.




oki :)

nuno
12-29-2001, 08:52 PM
lastpost info shouldn't be shown in private forums :rolleyes:

DarkReaper
01-01-2002, 08:07 PM
Problem - It shows posts from a private forum.

Category
-Forum 1
-Forum 2 - Private

If the last post was in Forum 2, it shows it for the last post of category, even though access is denied.

Scott MacVicar
01-01-2002, 08:10 PM
i'll look into this as soon as i have sobered up o_O

nuno
01-01-2002, 11:54 PM
hint:

index.php line 277 ;)

Omero
02-03-2002, 07:14 AM
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']='';
}

Omero
02-03-2002, 07:18 AM
Ah, i noticed i made the width of the text a bit smaller than PPN original hack, because i want to have the title with the link, and in bold :)

If you want it back original, just replace 25 with 30 and 23 with 28 in the code above... (the higher number is max number of chars of visibile title... if it's higher than that, it cuts it at 2 less than maximum and add ".." at the end ;) so 30-28 is fine for plain title, 25-23 is fine for bold title ;) )

Omero
02-03-2002, 07:33 AM
Updates:

A) I checked: yes it removes the title only when the "inaccessible" forum is visible from main page, NOT when it is under another forum, that is accessible. In that case it still shows the title... well it's better than nothing ;) Can someone help me out here? Maybe a loop checking the same thing for each subforum... dunno.

B) I'd like to manually update all the "lasttitle"... which query do I have to run in order to write all the "lasttitle", without having to wait for each forum to get updated with a new post?

Thanks for info, and thanks to PPN for the wonderful hack, which I'm trying with my VERY LOW knowledge, to improve a bit :) (or make it worse, we'll see ;) )

Scott MacVicar
02-03-2002, 08:56 AM
update forum info in the control panel and thanks for pointing out that the problem was with subforums I'll have a look into it today now that it is clarified.

Omero
02-03-2002, 08:16 PM
Originally posted by PPN
update forum info in the control panel and thanks for pointing out that the problem was with subforums I'll have a look into it today now that it is clarified.

NOTE: The problem is NOT ONLY with subforum, but with all private forums (im speaking about your original hack)

Your hack shows EVERY post, also from main private forums :) My small edit fix it for private forums directly under the mainpage, but not for subforums of visible forums :)

I think that could be fix adding another field in the db

lasttitle (that's what you use)
lasttitleforumid (with this you can check if the user has the permission to see that forum... if that's the case show the title, otherwise show " " :) )

I'll try this tonite ;)

Omero
02-04-2002, 06:10 AM
Hack update: with these updates down here, your hack will show the forum title ONLY for forums that the users can actually see, and has the permission to get in, and not for private forums he isn't able to see.

KNOWN BUG: it still shows the title for private forums that are under a public forum. (well i know it sux, but still better than viewing ALL the titles of private forums :D)

****************************

EXAMPLE:

MAINPAGE
|_ PUBLIC CATEGORY A
|_ _ PUBLIC FORUM A1
|_ _ PUBLIC FORUM A2
|_ _ _ (PUBLIC FORUM A2.1)
|_ _ _ (PRIVATE FORUM A2.2)
|_ _ PRIVATE FORUM A3


A2.1 and A2.2. don't get shown on mainpage, and if the last post was in A2.2. the title would be show in A2 even if A2.2 is private... A3 title instead don't get displayed, since it's not under a public fourm, and its visible directly, and the bug doesn't affect it ;)

***************************

This bug is because of the fact that I check the permission to see if the forum is accessible by the user, and if it is, then I display the title, otherwise I display " ".

BUT the title doesn't necessarily come from the forum I'm checking the permission, it could come from a subforum which has DIFFERENT permissions than the forum I'm checking... examples:

PUBLIC FORUM (i'm checking this forum and I therefore display the title... but...
-- PRIVATE SUBFORUM (... the last title comes from here so shouldn't be seen)

Presently there is NO way to know the forumid of the forum that "lasttitle" is from... i see 2 solutions of this, an easy but slow (adding a query) and a bit harder but fast:

A) EASY BUT SLOW: do a query and search where that title is from. When you get the forumid, you check permissions on THAT forum, and decide if displaying or not the title :)

B) HARDER BUT QUICK: add another field to the db... "lasttitleforum" which stores the "forumid" of the forum the "lasttitle" comes from, so we can check permissions on the right forum and decide if displaying or not the title, correctly.

I include here the new version of this hack, with improved (but not yet *final*) check for private forums... if you want something better that getting all the titles displayed get this, if you instead need that bug im speaking about fixed (this hits especially those who have a lot of "public forum-private subforum"), wait for PPN to release the real update ;)

Here it is, use it at your own risk (but it works).

Attachment removed by PPN, i've released a patch for it

Scott MacVicar
02-04-2002, 11:03 AM
I don't recommend using this as it will increase mysql load alot as it will increase the load of the page as it access' the getpermissions function which is more queries to the database, if they have alot of forums then alot of extra queries, I will release a completely fixed updated version tongiht hopefully.

Omero
02-04-2002, 03:06 PM
THanks :) I know my version wasn't the best thing.... i'm no coder ;)

I'll wait for yours :) Please provide an "update" txt also :D

LuBi
02-06-2002, 08:39 PM
Any word on the updated code?

Omero
02-07-2002, 05:35 AM
Not yet, i hope PPN release it...

Scott MacVicar
02-07-2002, 02:08 PM
I've spent ages lookin at the code and there is no easy way to get past the first level of forums without running another sql query and well i'm against running other sql queries.

I'll release the small modifications I have made to stop it showing private forums in that level of the forums. Though i highly recommend setting in the control panel that users can't view private forums.

NYI Fan
02-15-2002, 09:31 PM
Ok, Im feeling might foolish right now
I installed this awesome hack with no trouble on 2.2.0
I upgraded to 2.2.2 the other day and was just now getting to re-installing hacks - for some very bizzare reason, I cannot make this one work on 2.2.2

I've gone thru it 3 or 4 times now, each time i end up with parse errors. I should have been copying them down, but i was so sure it was just me being an idiot and missing something, i didnt bother.

Im gonna try again sometime tonight, but i was wondering if anyone else had any trouble getting it to work after they upgraded to 2.2.2?

If it fails again later, i will document my errors - I know you cant offer help without specifics... i'm just miffed cuz this is such a great addition, and not only do I miss it, my members are asking for it back...
Thanks!

Omero
02-16-2002, 06:47 AM
I have 2.2.2 and the hack is working perfectly ;)

Scott MacVicar
02-16-2002, 10:54 AM
I've installed this fine on everything from 2.0 RC1 to 2.2.2
I'll gladly help if your having problems though.

NYI Fan
02-16-2002, 11:28 AM
Thanks PPN
I will be trying again later today
i finished putting everything else back in so now this is the only one I'm missing
i have "real world" stuff to do today (i need an errand boy LOL)
but when i try again later i will post if im still experiencing fits of stupidity ;)

x28
02-22-2002, 10:29 AM
PPN

Every thing was working great untill i moved a topic form a main forum to a sub-form. Title shows but after a member posted to it when you click on the link it reads

"No thread specified. If you followed a valid link, please notify the webmaster"

url shows "www.myaddress/community/showthread.php?s=&threadid="

Also added this piece

https://vborg.vbsupport.ru/showthread.php?postid=175306#post175306

What do i need to do?

Omero
02-22-2002, 11:49 AM
PPN btw im still running my "modified" version of your hack. Could you come up with the final version, even if that means an added query, as I did? I would love to see your version instead of my crappy mod :)

bigmo
03-12-2002, 08:30 PM
After installing the hack I get these errors if I try to post, to reply and to update froum info:

Database error in vBulletin 2.2.4:

Invalid SQL: SELECT forumid,threadcount,replycount,parentlist,parentid ,lastpost,lastposter,lasttitle FROM forum WHERE INSTR(CONCAT(',',parentlist,','),',10,')>0
mysql error: Unknown column 'lasttitle' in 'field list'

mysql error number: 1054

Date: Tuesday 12th of March 2002 11:29:33 PM
Script: http://64.239.47.216/vb/vb/postings.php
Referer: http://64.239.47.216/vb/postings.php?action=deletethread&threadid=186

Some ideas ???

THX for help

So long...
BigMo

Mystics
03-12-2002, 08:35 PM
Originally posted by bigmo
Some ideas ??? Just read the Instructions from the beginning ;) first thing to do is to run this mysql query :P
ALTER TABLE `forum` ADD `lasttitle` VARCHAR(100) NOT NULL AFTER `lastposter`You need phpMyAdmin (http://phpwizard.net/projects/phpMyAdmin/) (for example) to run this Query.

Scott MacVicar
03-12-2002, 08:48 PM
Sorry i never posted the changes..
here they are

look for
if (!$hideprivateforums) {
$forumperms['canview']=1;
}

above it add

$trueperm['canview'] = $forumperms['canview'];

now use

if($trueperm['canview']) {
$forum['lasttitle']=unhtmlspecialchars($forum['lasttitle']);
if (strlen($forum['lasttitle']) > 30) {
$forum['lasttitle'] = substr($forum['lasttitle'], 0, 28);
$forum['lasttitle'] .= '..';
}
}

i've updated the main file now.

inetd
03-13-2002, 03:13 AM
In what file it is necessary to make these changes?

bigmo
03-13-2002, 09:04 AM
@Mystics

Hihi...sorry I didnt see it...

THX

@ppn
i've updated the main file now.

Where can I get these main file ???

Scott MacVicar
03-13-2002, 10:28 AM
index.php and forumdisplay.php and look at the very first post for the main hack file :)

bigmo
03-13-2002, 12:11 PM
what is the diference betwen vb_last_title.txt and vb_last_title_new.txt ??

Scott MacVicar
03-13-2002, 02:57 PM
the vb_last_title_new.txt was by Omero, though it runs an extra query for each forums, I'll go remove it in a minute.
Anyway my version doesn't run the extra query and is therefore ideal :P

TWTCommish
03-13-2002, 03:00 PM
Therefore ideal? Hardly. I find mine are always getting mucked up...moved threads, deleted threads, stuff like that. There is definitely something to be said for another query here or there if it helps keep the integrity of the last post display.

Scott MacVicar
03-13-2002, 03:52 PM
hmm this one shouldn't muck it up as it relies on the updateforumcount function, so if you move or delete threads it gets the last thread and updates its value, its the main editing in /admin/functions.php which allows this to do so.
And one query per page view it alot and puts alot of extra server load.

bigmo
03-13-2002, 07:50 PM
@PPN

I installed the hack as you described in the txt-file. The problem now is that I have an Admin&MOD-Forum eg. and i dont want the normal user to see the last title in these forum.

How can I do this?

THX for help

Erwin
03-13-2002, 08:43 PM
Make that forum private. :)

Scott MacVicar
03-13-2002, 09:06 PM
in your vBulletin Options select hide private forums.

bigmo
03-14-2002, 06:05 AM
the problem is that useres who are not registred can see the forums but can not access those. When I turn on the "hide private forum" option then those useres can´t see any forum, and that´s bad.

The optimal solution for me would be the following:

All forums are visible, but the lasttitle is only displayed at forums the user can access and view. Forums the user dont have the premission to access (eg Admin-Fourm) are visible but the user dont see the lasttitle...

Is it possible to configure it so...???

THX
BigMo

Scott MacVicar
03-14-2002, 07:55 AM
The code i adjusted sorted this cause it checks if the user has permission to view the forum and if they don't have it then it is hidden. Though this could be changed to check if they are allowed to view other threads or any other sort of permission for a forum. Will show the changes when i get home.

bigmo
03-14-2002, 04:00 PM
Oh THX that would be fine...

BigMo

psychopathic
03-16-2002, 05:51 PM
umm.. i installed this hack and now my post and thread counts are acting screwy. When i reply to a thread, the thread count goes to 0 or something along that line.

http://planetplastica.com/forums/index.php - see for yourself.

psychopathic
03-17-2002, 03:07 AM
the support on this forum is simply stunning.

Scott MacVicar
03-17-2002, 08:52 AM
NO need to bump the topic after a couple of hourse, some of us actually do things outside of vBulletin. Try updating forum info within the Update Counters part of the admin panel.

If this doesn't work then you have made an error while applying it to /admin/functions.php

psychopathic
03-17-2002, 12:31 PM
i just figured that i'd get SOMETHING after 10 hours of waiting, but alas, i got nothing.

Thanks for the response PPN. Right now my vB is offline, but the ftp seems to still work.. strange, anyway, i had previously updated everything in attempt to fix it, and just now i re-modified functions.php and i'll let you know how it turns out when my site comes back online. thanks.

Tim Wheatley
03-18-2002, 07:51 AM
Originally posted by PPN
if (strlen($forum['lasttitle']) > 30) {
$forum['lasttitle'] = substr($forum['lasttitle'], 0, 28);
$forum['lasttitle'] .= '..';
}

above that add the following
$forum['lasttitle']=unhtmlspecialchars($forum['lasttitle']);

if the length is over 30, remove everything after 28 characters and add two dots to the end.

Hope this helps, instruction file now updated.

Doesn't seem to work for Opera... Any ideas? :)

Tim Wheatley
03-18-2002, 07:51 AM
Originally posted by PPN
sorry about this i forgot to unhtmlspecialchars the title.


within index.php and forumdisplay.php look for the follow lines which you added.

if (strlen($forum['lasttitle']) > 30) {
$forum['lasttitle'] = substr($forum['lasttitle'], 0, 28);
$forum['lasttitle'] .= '..';
}

above that add the following
$forum['lasttitle']=unhtmlspecialchars($forum['lasttitle']);

this should solve the problem with the characters not being converted.

Also the decision on length is made by the top code a quick explanation is, if the length is over 30, remove everything after 28 characters and add two dots to the end.

Hope this helps, instruction file now updated.

This does not seem to work for Opera - any ideas? :)

(The text limiting I mean - Opera users get a big long line of text...)

bigmo
03-18-2002, 08:34 AM
Originally posted by PPN
Though this could be changed to check if they are allowed to view other threads or any other sort of permission for a forum. Will show the changes when i get home.

@PPN
Have you forgotten me????

Please post the changes here...thats would be fine

THX
BigMo

Scott MacVicar
03-18-2002, 08:35 PM
you can change

$trueperm['canview'] = $forumperms['canview'];

change the $forumperms['canview']; to whatever sort of permission you want.

such as
canview, canpostnew, canviewothers, canreplyothers, canreplyown

bigmo
03-19-2002, 05:42 AM
OK THX...

My last question:

in which file at which position I must add/change the
PHP:

$trueperm['canview'] = $forumperms['canview'];

???

Wayne2k1.com
03-20-2002, 10:30 AM
It doesn't work 4 me.

:(

The hack works perfectly, but it shows last post for private forums, too...and that's baaaad.

bigmo
03-20-2002, 11:44 AM
Yes I tested it vesterday (I changed the index.php und the forumdisplay.php) and it dont work for me too. The lastpost is still displayed at forums the user dont have the right to access...

Some other solutions ???

THX

Harvey
03-20-2002, 02:46 PM
ok, here is an better but still untested!!! version.

It looks up, if a registered user can view a forum.
if Yes: put the title into the forum and the patents.
if No: put "(private message)" into the forum and the patents.

This design is because IMHO it is impossible to look up if the title is from a private subforum without doing a query.

First apply the changes from PPN
then my changes
then post dummy threads in the private forums.

Sorry for not testing, I currently have no testforum.

Wayne2k1.com
03-27-2002, 09:41 AM
Doesn't work.

Invalid SQL: max(canview) as cveiw ,count(canview) as cnt from forumpermission where usergroupid=2 and forumid=5
mysql error: You have an error in your SQL syntax near 'max(canview) as cveiw ,count(canview) as cnt from forumpermission where usergrou' at line 1

That's the error.

Harvey
03-27-2002, 09:50 AM
ups - forgotten "select "

Thank you

Wayne2k1.com
03-27-2002, 10:08 AM
I guessed that...but I see you just noticed by yourself :)

It works...but it still gives an error in "Update Counters" --> "Forum Info"

SELECT max(canview) as cveiw ,count(canview) as cnt from forumpermission where usergroupid=2 and forumid=
mysql error: You have an error in your SQL syntax near '' at line 1

I think it's because from misc.php it doesn't have the

.$getchildforum[forumid]

variable.

Harvey
03-27-2002, 02:46 PM
ok, I dont understand the reason for it (I don't think it's from misc.php). I have to create a test system, but this week I have no time.

Scott MacVicar
03-27-2002, 03:37 PM
Harvey you decide if it should set the thread title if they can view it, what if they can't view the forum, why would they be posting in it :D

This is done in vBulletin 3 anyway, why can't you all just hide private forums within the general settings part of the admin panel.

Harvey
03-27-2002, 05:56 PM
PPN, the actual problem is, if you have a privat subforum inside a nonprivate mainforum, everybody can see the the title in the mainforum, if the latest thread is in the private forum. No matter if you hide the private forum or not. You can see it, because it's the same with last time and last poster.

Sorry that my solution does not work yet, I tried it in theorie because I have currently not the time to test it. Perhaps with the hope, that I find a Betatester ;) My boss wants that I install your hack, and we can live with the decision if a new post belongs to a thread a registered user may see or not.

I hope you can understand me, I can't translate your first sentence because of my terrible english. Perhaps I can learn by posting in your forum.

PS: Great hack.

JTMON
04-06-2002, 10:04 PM
Parse error: parse error in /usr/local/plesk/apache/vhosts/whatthefrag.com/httpdocs/forums/admin/functions.php on line 1892

Fatal error: Call to undefined function: makelogincode() in /usr/local/plesk/apache/vhosts/whatthefrag.com/httpdocs/forums/global.php on line 337

I'm running 2.2.5. This happens when I upload functions with the changes

infamous one
04-06-2002, 11:44 PM
ALTER TABLE `forum` ADD `lasttitle` VARCHAR(100) NOT NULL AFTER `lastposter`

How would I go about removing this from my table?

Harvey
04-07-2002, 09:44 AM
alter table forum drop column lasttitle

kms
04-11-2002, 03:35 AM
hi anybody tested this on v2.25 ?

TIA :)

Wayne2k1.com
04-11-2002, 06:48 AM
Originally posted by kms
hi anybody tested this on v2.25 ?

TIA :)

Yep.

It works perfectly. (even the Omero sub-hack...look at it if you need to hide thread titles from private forums).

:laugh:

yasunari
04-14-2002, 06:10 AM
I have it work on my board too (vbb 2.2.5) :squareeyed:

http://www.kelvinlo.net/vbb/

But I found that after I deleted or moved the post, I will saw the Last Post field will turn into Never...
It is normal or anyway can fix it?

yasunari
04-14-2002, 06:54 AM
After i do forum update counter..

https://vborg.vbsupport.ru/

.I need to wait new members post/reply topic to get that field back.. anyway I can fix it?

Scott MacVicar
04-14-2002, 09:52 AM
Ok i'll load this onto my test board just now, this is probably due to the editing done in functions.php

SoliduS_cF
04-19-2002, 05:43 PM
Just installed it on 2.2.5 and receiving this parse error when creating a new thread:

Parse error: parse error in /homepages/4/d26384347/htdocs/forums/newthread.php on line 252

zachb
04-23-2002, 01:01 AM
<a href="http://www.sfpunk.com/forum/forumdisplay.php?forumid=2" target="_blank">http://www.sfpunk.com/forum/forumdisplay.php?forumid=2</a>

I get a parse error when going to a forum. I have rehacked forumdisplay 3 times to make sure it wasn't me and it still does not work. :ermm:

Wayne2k1.com
04-23-2002, 05:45 AM
Strange thing...works fine x me in 2.2.5 too...

zachb
04-25-2002, 01:41 AM
bump.

Mystics
04-25-2002, 01:03 PM
@zachb
Why don't you post line 355-364, so we can see what's wrong with it....

Or send me (mystics27@gmx.net) your forumdisplay.php so I can check it.

Mystics

kms
04-25-2002, 11:41 PM
Originally posted by JTMON
Parse error: parse error in /usr/local/plesk/apache/vhosts/whatthefrag.com/httpdocs/forums/admin/functions.php on line 1892[/i]

i got the same with v2.2.5 but line 1893, got an extra } in there some how??, deleted one then ok

Originally posted by JTMON
Fatal error: Call to undefined function: makelogincode() in /usr/local/plesk/apache/vhosts/whatthefrag.com/httpdocs/forums/global.php on line 337[/i][/b] do your template & update counters thing :)

kms
04-26-2002, 12:03 AM
aagghh, just noticed the forum post counters are all wrong on the front page, most show 0 posts etc. How do i fix this ?

TIA

kms
04-26-2002, 12:42 PM
hmmm ignore my advise, deleting that } just stops any of the forums counters from working.

My forums now have all the updated files and template as per the mod instructions except for admin/functions.php which is back to the old version and everything seems to be working ok ???

What are the implications of this ? Or better still how can i stop the

Parse error: parse error

&

Fatal error: Call to undefined function: makelogincode()

as above ???

THanks in advance

kms
04-26-2002, 12:49 PM
p.s. this is my admin/functions.php at present all other files and templates as per hack instructions, why wont the mods work ? TIA :)

[code removed by PPN]

Mystics
04-26-2002, 12:55 PM
@kms

Do NOT post the functions.php!!!!!

Please edit your Posting and remove the whole code.

Mystics

Scott MacVicar
04-26-2002, 01:29 PM
send the functions.php to scott.macvicar@vbulletin.org and I'll look it over

kms
04-26-2002, 01:39 PM
sorry about that, will mail it now :)

zachb
04-26-2002, 11:58 PM
Email sent, Mystics. Thanks in advance for the help!

TObject
04-29-2002, 10:29 PM
I am in the middle of installing this hack. I was about to go to moodify templates, I clicked on Templates - Modify in the Admin Pane, and got:


Parse error: parse error in /***/admin/functions.php on line 811

Fatal error: Call to undefined function: vbdate() in /***/admin/sessions.php on line 356

TObject
04-29-2002, 10:45 PM
Here is the line # 811:

$buffer = str_replace(""", "\"", $buffer);


And here is the block of code this line is in:

// ###################### Start phphighlite #######################
function phphighlite($code) {
//PHP 4 only

if (floor(phpversion())<4) {
$buffer=$code;
} else {
$code = str_replace("<br>", "", $code);
$code = str_replace("<br />", "", $code);
$code = str_replace(">", ">", $code);
$code = str_replace("<", "<", $code);

$code = str_replace("&", "&", $code);
$code = str_replace('$', '\$', $code);
$code = str_replace('\n', '\\\\n', $code);
$code = str_replace('\r', '\\\\r', $code);
$code = str_replace('\t', '\\\\t', $code);

$code = stripslashes($code);

if (!strpos($code,"<?") and substr($code,0,2)!="<?") {
$code="<?\n".trim($code)."\n?>";
$addedtags=1;
}
ob_start();
$oldlevel=error_reporting(0);
highlight_string($code);
error_reporting($oldlevel);
$buffer = ob_get_contents();
ob_end_clean();
if ($addedtags) {
$openingpos = strpos($buffer,'<?');
$closingpos = strrpos($buffer, '?');
$buffer=substr($buffer, 0, $openingpos).substr($buffer, $openingpos+5, $closingpos-($openingpos+5)).substr($buffer, $closingpos+5);
}
$buffer = str_replace(""", "\"", $buffer);
}

return "</normalfont><blockquote><pre><smallfont>PHP:</smallfont><hr>$buffer<hr></pre></blockquote><normalfont>";
}


Does anyone see anything wrong?

TObject
04-29-2002, 11:06 PM
I rolled back all the changes to PHP files, and I still get the parse error on line 811 of admin/functions.php

TECK
04-29-2002, 11:19 PM
just to let you.. i installed this hack without a problem in 225. it works like a charm. it's a great hack for busy boards. however, i made a little hack similary to this. PPN was kind enough to look at the code and his conclusion was that the code is reliable only for medium to small boards. i totally agree with him.

concerning the PPN's hack installation, is simple and precise, all you have to do is follow at letter his instructions.
a little note:
if you installed this hack, make sure you reply or post into a thread, if you dont see any latest title available in forumhome. it will update the database.

for my hack, you could evaluate the comments made by firefly and PPN here:
https://vborg.vbsupport.ru/showthread.php?s=&threadid=37952

one more time, if you follow PPN's install guidelines, it will work great. i know i did and got it working in about 5minutes. ;)
good luck and happy hacking. :D

TObject
04-29-2002, 11:46 PM
I think I figured out what my problem was. I used the editor from within the cpanel, and the god dammed thing replaced &-strings inside the PHP file (such as &nbsp) with gibberish.

I will catch my breath, and try loading this hack again.

TObject
04-30-2002, 12:42 AM
I edited the files again (this time using the PHP Coder Pro), and it looks like it's working! Thank you!

http://www.jeepbbs.net/forums/index.php

The only problem is that Updating Forums info (threough the "Update Counters") did not make the titles to appear. The titles only start appearing as users post new messages.

TECK
04-30-2002, 01:24 AM
congrats :)
did you read my post above? it shows when someone posts because it updates the field only when someone posts... ;)

Dark Odin
04-30-2002, 07:52 PM
How many queries does this add?

TECK
04-30-2002, 10:22 PM
none.

yasunari
04-30-2002, 10:56 PM
Originally posted by yasunari
After i do forum update counter..

http://evillage.uhome.net/upload/VBBWO.gif

.I need to wait new members post/reply topic to get that field back.. anyway I can fix it?

Anyone have my problems after update forum counter or move/delete post?

I am using 2.2.5 :)

Scott MacVicar
05-01-2002, 02:09 PM
I have checked this code and it works fine with my 2.2.5 board, the conclusion is that you have applied the hack inccorectly to the /admin/functions.php file.

Try re-applying or checking that code again.

yasunari
05-02-2002, 12:39 AM
Thanks, I will check the code to see any problems :D

Bald Bouncer
05-06-2002, 07:29 AM
I installed on 2.2.5 word for word and Im getting a lot of errors on the main page that look like :(

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /home/whynot-d/public_html/udfxp/index.php(332) : eval()'d code on line 2

Bald Bouncer
05-06-2002, 07:32 AM
ok I sorted it you said to add

$form['lasttitle']

to the template when it should be

$form[lasttitle]

brilliant hack Btw!

Bald Bouncer
05-06-2002, 07:46 AM
edited

kms
05-07-2002, 01:24 PM
Originally posted by PPN
send the functions.php to scott.macvicar@vbulletin.org and I'll look it over hiya PPN, any luck m8 ?

TIA

mashby
05-07-2002, 02:19 PM
A rather lengthy hack, but it installed just as described and works like a charm. Thanks for making such a great hack!

mashby
05-07-2002, 02:21 PM
I noticed that the thread title for items in "private" forums don't show up on the home page. Is that intentional?

Boofo
05-18-2002, 05:22 AM
I just installed this hack and when I tried to update the forum counters, I got this error. Can you tell me what it means and what I need to do, please?

Database error in vBulletin Control Panel 2.2.5:

Invalid SQL: SELECT * FROM thread WHERE forumid='1' AND lastposter='Boofo's Babe' AND lastpost='1021587428'
mysql error: You have an error in your SQL syntax near 's Babe' AND lastpost='1021587428'' at line 1

mysql error number: 1064

Date: Saturday 18th of May 2002 07:10:17 AM
Script: http://www.bearfacts2.com/forum/forum/admin/misc.php
Referer: http://www.bearfacts2.com/forum/admin/misc.php?action=chooser

Boofo
05-18-2002, 08:04 AM
It seems that SQL doesn't like user names with apostrophies in them. "Boofo's Babe" was reading as "s Babe" and the DB didn't like that. I went ahead and posted in the forums and re-ran the update counters and it went off without a hitch with me as the last poster. Is there any way around this so users can use apostrohies in their names if they like?

BTW: Great hack, PPN! (as usual) :)

Jen
05-18-2002, 05:27 PM
I have one quick question that doesn't seem to have been covered yet..

I want to guarantee that the user ALWAYS goes to the thread shown as the last post, but if you load up the index, wait for a few more posts to be made and then click the thread link it goes to the newest thread, NOT the one listed as last post.

This is confusing my users to no end (if they'd only click a little faster it wouldn't be a problem ;) ).

Is there any way to set the goto link to go to the thread listed as the last post even if there have been new posts made since?

Franki
05-20-2002, 12:18 AM
I installed this hack and works fine BUT not with polls. I posted a new thread with poll and it didn't appear as a new post in the forum home page. Why is that?

Boofo
05-20-2002, 12:24 AM
It works with polls here fine. I am running version 2.2.5, what are you running?

Frank-kun
06-01-2002, 12:02 AM
Hmm..looks like I have a problem...

Had this hack since 2.2.0 and it's worked like a charm ever since - just did the Beyond Compare thing and it worked fine. But I updated to 2.2.6 today and it's having a problem. It works fine on a new reply or new thread, but won't work on moving or deleting threads or posts. It just puts it as before, with just name and date.

I tried installing from scratch, doing the update forums info thing again, still no dice.

Curiously enough it does seem to be leaving a space for the last title on forum home, it's just that it's blanked.

Could someone give some insight or perhaps point me to the file that deals with the move/delete to try and fix this?

Frank-kun
06-01-2002, 01:57 PM
Hey, how about that, I solved my own problem ;)

I believe that in 2.2.6, the file to update forum post counts and lastposters was changed, so that the "title" is not part of the SELECT statement that is called in order to get the lastposts info. Because of this, $lasttitle is set to blank because according to the code, it tries to set itself using the "title" variable.

As a quick fix, you can simply have the SELECT statement call the title column again. So if you have this hack installed, your code should look like this:

in admin/functions.php:


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'];
$lasttitle=$lastposts['title'];


Just replace it with:


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'];
$lastposter=$lastposts['lastposter'];
$lasttitle=$lastposts['title'];


...and you should have no problems with moving/deleting with PPN's Last Title hack.

Now, I don't know if the "title" was taken out of the code for some reason to fix a bug, but if it was, perhaps a better fix that preserves the bugfix might be more useful. But this one's a quick fix.

Thanks again PPN for a great hack.

Boofo
06-01-2002, 02:01 PM
Do you need to chnage it to this for 2.2.5 too or just 2.2.6?

Frank-kun
06-01-2002, 06:55 PM
Originally posted by Boofo
Do you need to chnage it to this for 2.2.5 too or just 2.2.6?

Probably just for 2.2.6. If you're working ok with the hack and you have 2.2.5 you should probably just leave it be. But if you're having problems when you move or delete posts, then you should probably try to apply the change.

Boofo
06-01-2002, 07:33 PM
Would it mess anything up to just go ahead and add it to avoid any problmes that could arise? I mean, if it won't hurt anything then it might be a good idea to go ahead and update it.

Originally posted by Frank-kun


Probably just for 2.2.6. If you're working ok with the hack and you have 2.2.5 you should probably just leave it be. But if you're having problems when you move or delete posts, then you should probably try to apply the change.

alanvo
07-03-2002, 08:55 AM
it screws up my tables, why is that, can anybody please help me...

http://www.demsang.net/forums

Boofo
07-03-2002, 09:42 AM
You need to change the length you want the last time to be in this line:

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

The default length of the last title is 28 right now. Either make it a smaller number or add space.gif to your forumhome_forumbit_level1_nopost like this:

<td bgcolor="#1D6AA0" nowrap><smallfont color="#EEEEFF"><img src="https://vborg.vbsupport.ru/images/space.gif" width="200" height="1"><br><b>Last Post</b></smallfont></td>

Originally posted by alanvo
it screws up my tables, why is that, can anybody please help me...

http://www.demsang.net/forums

fonzerelli_79
07-04-2002, 12:23 PM
i installed the hack on my test forums and everything seems fine when i upload the files

when i change the template though i get this error on the forums home

Parse error: parse error, expecting `']'' in ......./index.php(362) : eval()'d code on line 2

any ideas folks? ;)

Dark Jim
07-07-2002, 11:02 PM
I would also like to have the posticon used last next to it on the forum home. :)

N9ne
07-09-2002, 08:03 PM
[QUOTE]Originally posted by PPN
ok 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='$foruminfo[lastposter]' AND dateline='$foruminfo[lastpost]'"));
header("Location: showthread.php?s=$session[sessionhash]&threadid=$lastthread[threadid]");
exit;
}
}

now change the bit i told you to to
<a href="showthread.php?s=$session[sessionhash]&goto=newthread&forumid=$forum[forumid]">$forum[lasttitle]</a>

sorry it took so long to reply, i thought vBulletin would have had a way to do this, but it didn't so i wrote one.

Boofo
07-16-2002, 09:21 PM
Scott,

Have you had a chance to look at the problem I am haing with apostrophes in the last poster name? (Posts 185 and 186 of this thread). :)

Courage
07-18-2002, 06:56 PM
If someone post a new thread with the subject

<iframe src="http://www.vbulletin.org"></iframe>

the iframe apears in the main page of my forum ! :@
My forum is so ++++ed UP ! ;(

Need support !

Boofo
07-27-2002, 11:46 PM
Scott,

I have one last title on the forum home that keeps giving me the errorid error when I click on the last title link. The others work fine but this one thread will not go to the first post when you click on it. The last post button will take you to the last post ok. Any ideas what could be causing this? And I already did the updates for forum counters and stuff and it didn't change anything.

And any word on the apostophes in the name causing db errors when I update the counters? Any help would be appreciated. :)

si@smscworld
07-28-2002, 01:03 PM
Hi, not sure if this has already been mentioned, but here goes anyway:

I have installed this hack fine and it works great, thanks PNN. But I have a Admin Only Area and I don't want other members seeing what threads are being made in this forum. Can someone tell me how to remove the last thread on that section. Thank you for reading and I hope someone can help me

si@smscworld
07-29-2002, 07:33 AM
Anyone? surely someone has sorted this out!

Austin Dea
07-31-2002, 06:47 PM
I had my sizs all set and it was working fine but I upgraded to 2.2.6 and now I can't get the sizes to work at all.


$forum['lasttitle']=unhtmlspecialchars($forum['lasttitle']);
if (strlen($forum['lasttitle']) > 20) {
$forum['lasttitle'] = substr($forum['lasttitle'], 0, 17);
$forum['lasttitle'] .= '...';
}


Is it something to do with the new php version o_O...

Boofo
07-31-2002, 06:55 PM
Here's what I have and it works fine.

$forum['lasttitle']=unhtmlspecialchars($forum['lasttitle']);
if (strlen($forum['lasttitle']) > 30) {
$forum['lasttitle'] = substr($forum['lasttitle'], 0, 28);
$forum['lasttitle'] .= '..';
}

Originally posted by Austin Dea
I had my sizs all set and it was working fine but I upgraded to 2.2.6 and now I can't get the sizes to work at all.


$forum['lasttitle']=unhtmlspecialchars($forum['lasttitle']);
if (strlen($forum['lasttitle']) > 20) {
$forum['lasttitle'] = substr($forum['lasttitle'], 0, 17);
$forum['lasttitle'] .= '...';
}


Is it something to do with the new php version o_O...

Austin Dea
07-31-2002, 07:20 PM
Yours is the same thing only longer..

Maybe I need to reinstall... but i thought the index.php part of the hack would be the only thing that controls the length...

Austin Dea
07-31-2002, 07:45 PM
ARe you on 2.2.6? Because mine stilll doesn't work after re-installing...

Austin Dea
08-01-2002, 10:58 PM
Boofo, you're not using vB 2.2.6 at www.bearfacts2.com/forum/ ...

Boofo
08-01-2002, 11:05 PM
You got me there. :)

The code is the same code I have given a few people with 2.2.6 and it has worked fine for them. Sorry that it doesn't for you. :disappointed:

What is exactly happening when you insert your code? Is anything showing at all? The forumhome template was supposed to be changed in 2.2.6. Could that possibly be a problem? I don't know, I'm just guessing here. :)

Originally posted by Austin Dea
Boofo, you're not using vB 2.2.6 at www.bearfacts2.com/forum/ ...

Austin Dea
08-01-2002, 11:59 PM
It's not your fault it doesn't work...

It works fine, but I can't restrict the length so it's messing my tables up.

Boofo
08-02-2002, 12:09 AM
have you tried using space.gif to make all of the last post boxes the same length? When they are not joined, this is what you have to do. :)

Austin Dea
08-02-2002, 12:41 AM
Well I don't want it as big as it is in the first place =P.

Austin Dea
08-04-2002, 08:26 PM
Bah, sorry guys. I figured out hwy it wasn't working. I missed this step...

look for
if (!$hideprivateforums) {
$forumperms['canview']=1;
}

*above it add
$trueperm['canview'] = $forumperms['canview'];

Geez...sorry for all the confusion. It works perfectly fine on 2.2.6.

Tim Wheatley
08-12-2002, 08:17 PM
Um... reading through this I'm lost... what works - what doesn't - on 2.2.6?

Austin Dea
08-13-2002, 03:30 AM
It works on 2.2.6.

Frank
08-13-2002, 10:26 AM
Nice hack

dwh
08-15-2002, 03:36 AM
I've modified this to work with icons...I tried it briefly but not sure if there are any issues...try it out...but only on a test board...please don't install on a production board until people say they have tested it...hopefully PPN will modify his instructions (I did not bother w/ any version older than 2.2.6 and I had a lot of trouble with this hack..mostly because of the $form['lasttitle'] which has 2 mistakes...$forum[lasttitle] is correct...but nonetheless, very good concept and very well done..thanks for your hard work PPN a+!

I installed this hack on a **fresh** vBulletin 2.0.1, though as i'm updating this file i'll tell you i've tested it on 2.0.1, 2.0.2, 2.0.3, 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.2.3b and 2.2.4. This means every version btw :)

first thing to do is to run this mysql query :P
ALTER TABLE `forum` ADD `lasttitle` VARCHAR(100) NOT NULL AFTER `lastposter`
ALTER TABLE `forum` ADD `lasticonid` SMALLINT(5) NOT NULL AFTER `lasttitle`

open /admin/functions.php
-----------------------------

on line 1456 look for
$lastposter='';

below add

//LT HACK
$lasttitle='';
$lasticonid='';
//END HACK
-------

then look for

$getchildforums=$DB_site->query("SELECT forumid,threadcount,replycount,parentlist,parentid ,lastpost,lastposter FROM forum WHERE INSTR(CONCAT(',',parentlist,','),',$forumid,')>0");

change to

//LT HACK
$getchildforums=$DB_site->query("SELECT forumid,threadcount,replycount,parentlist,parentid ,lastpost,lastposter,lasttitle,lasticonid FROM forum WHERE INSTR(CONCAT(',',parentlist,','),',$forumid,')>0");
//END LT HACK
-------

then look for

$lastpost=$getchildforum[lastpost];
$lastposter=$getchildforum[lastposter];

below add
//LT HACK
if($getchildforum[lasttitle]=='') {
$newtitle=$DB_site->fetch_array($DB_site->query("SELECT * FROM thread WHERE forumid='$forumid' AND lastposter='$getchildforum[lastposter]' AND lastpost='$getchildforum[lastpost]'"));
$lasttitle=$newtitle[title];
$lasticonid=$newtitle[iconid];
}
else {
$lasttitle=$getchildforum[lasttitle];
$lasticonid=$getchildforum[lasticonid];
}
//END LT HACK
-------

then look for

$lastposts=$DB_site->query_first("SELECT lastpost,lastposter FROM thread WHERE lastpost='$lastposts[lastpost]'");
$lastpost=$lastposts['lastpost'];
$lastposter=$lastposts['lastposter'];

change to
//LT HACK
$lastposts=$DB_site->query_first("SELECT lastpost,lastposter,title,iconid FROM thread WHERE lastpost='$lastposts[lastpost]'");
$lastpost=$lastposts['lastpost'];
$lastposter=$lastposts['lastposter'];
$lasttitle=$lastposts['title'];
$lasticonid=$lastpost['iconid'];
//END LT HACK
-------
FOR VB 2.2.x

look for
if ($lastpost!=$currentlastpost) {
$lastpostquery=",lastpost='$lastpost',lastposter='".addslashes($lastposter)."'";
} else {
$lastpostquery="";
}

change to
//LT HACK
if ($lastpost!=$currentlastpost) {
$lastpostquery=",lastpost='$lastpost',lastposter='".addslashes($lastposter)."',lasttitle='".addslashes($lasttitle)."',lasticonid='$iconid'";
} else {
$lastpostquery="";
}
//END LT HACK
save the file and upload

open /newthread.php
-----------------------------

on line 231 to 233 you should see the following
if ($visible==1) {
$DB_site->query("UPDATE forum SET replycount=replycount+1,threadcount=threadcount+1, lastpost='".time()."',lastposter='".addslashes($postusername)."' WHERE forumid IN ($foruminfo[parentlist])");
}

change it to
//LT HACK
if ($visible==1) {
$DB_site->query("UPDATE forum SET replycount=replycount+1,threadcount=threadcount+1, lastpost='".time()."',lastposter='".addslashes($postusername)."',lasttitle='".addslashes(htmlspecialchars($subject))."',lasticonid='".addslashes($iconid)."' WHERE forumid IN ($foruminfo[parentlist])");
}
//END LT HACK
save the file and upload

open /editpost.php
-----------------------------

on line 233 to 235 you should see the following
if ($isfirst and $title!="" and $postinfo[dateline]+$editthreadtitlelimit*60>time()) {
$DB_site->query("UPDATE thread SET title='".addslashes(htmlspecialchars($title))."' WHERE threadid=$threadinfo[threadid]");
//$title="";
}

change it to
//LT HACK
if ($isfirst and $title!="" and $postinfo[dateline]+$editthreadtitlelimit*60>time()) {
$DB_site->query("UPDATE thread SET title='".addslashes(htmlspecialchars($title))."' 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 lasttitle='".addslashes(htmlspecialchars($title))."',lasticonid='".addslashes($iconid)."' WHERE forumid=$threadinfo[forumid]");
}
//$title="";
}
//END LT HACK
save the file and upload

open /newreply.php
-----------------------------

on line 279 to 281 you should see the following
if ($visible==1) {
$DB_site->query("UPDATE forum SET replycount=replycount+1,lastpost='".time()."',lastposter='".addslashes($postusername)."' WHERE forumid IN ($foruminfo[parentlist])");
}

change it to
//LT HACK
if ($visible==1) {
$DB_site->query("UPDATE forum SET replycount=replycount+1,lastpost='".time()."',lastposter='".addslashes($postusername)."',lasttitle='".addslashes(htmlspecialchars($threadinfo[title]))."',lasticonid='".addslashes($iconid)."' WHERE forumid IN ($foruminfo[parentlist])");
}
//END LT HACK
save the file and upload

open /index.php
-----------------------------
ON LINE 91 for Version 2.2.6

look for

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

CHANGE TO

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


look for
if (!$hideprivateforums) {
$forumperms['canview']=1;
}

above it add
//LT HACK
$trueperm['canview'] = $forumperms['canview'];
//END LT HACK

on line 266 to 267 you should see the following
$forum['lastpostdate']=vbdate($dateformat,$forum['lastpost']);
$forum['lastposttime']=vbdate($timeformat,$forum['lastpost']);

below there add
//LT HACK
if($trueperm['canview']) {
$forum['lasttitle']=unhtmlspecialchars($forum['lasttitle']);
if (strlen($forum['lasttitle']) > 30) {
$forum['lasttitle'] = substr($forum['lasttitle'], 0, 28);
$forum['lasttitle'] .= '..';
}
if ($forum['lasticonid']) {
$icon="<img src=\"$forum[iconpath]\" alt=\"$forum[icontitle]\" width=\"15\" height=\"15\" border=\"0\">";
} else {
$icon="<img src=\"images/icons/icon1.gif\">";
}
}
//END LT HACK
save the file and upload

open /forumdisplay.php
-----------------------------


LOOK FOR

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

CHANGE TO

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



look for
if (!$hideprivateforums) {
$forumperms['canview']=1;
}

above it add
$trueperm['canview'] = $forumperms['canview'];

on line 197 to 198 you should see the following
$forum['lastpostdate']=vbdate($dateformat,$forum['lastpost']);
$forum['lastposttime']=vbdate($timeformat,$forum['lastpost']);

below there add
//LT HACK
if($trueperm['canview']) {
$forum['lasttitle']=unhtmlspecialchars($forum['lasttitle']);
if (strlen($forum['lasttitle']) > 30) {
$forum['lasttitle'] = substr($forum['lasttitle'], 0, 28);
$forum['lasttitle'] .= '..';
}
if ($forum['lasticonid']) {
$icon="<img src=\"$forum[iconpath]\" alt=\"$forum[icontitle]\" width=\"15\" height=\"15\" border=\"0\">";
} else {
$icon="<img src=\"images/icons/icon1.gif\">";
}

}
//END LT HACK
save the file and upload


IN THE TEMPLATE, $icon will give you the full icon.

Ok, now to edit the templates, this isn't hard you just have to edit one.

In the control panel go to the "forumhome_lastpostby" template
within it you may add $forum['lasttitle'] to show the last thread title to be posted to, i chose the following format for my board.

<table cellpadding="0" cellspacing="0" border="0" width="100%" id="ltlink"><tr align="right">
<td nowrap><smallfont><a href="showthread.php?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]">$forum[lasttitle]</a><br>$forum[lastpostdate] <font color="#FF9C58">$forum[lastposttime]</font><br>
by <a href="member.php?s=$session[sessionhash]&action=getinfo&find=lastposter&forumid=$forum[forumid]"><b>$forum[lastposter]</b></a></smallfont></td>
<td nowrap>&nbsp;<a href="showthread.php?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]"><img src="https://vborg.vbsupport.ru/images/lastpost.gif" border="0" alt="Go to last post"></a></td>
</tr></table>


After changing the template run Update Forums info, this can be found in the "Update counters..." section of the control panel. This will make the titles appear.
Support can be gained from the vBulletin forums only, any other form of contact will be ignored.


PPN
software@pp-network.com

Also, don't miss the fact that I added a new field in forums and the SQL is at the top of the modified instructions.

Boofo
08-15-2002, 07:06 PM
Can you supply a screenshot?

Webmasta XT
08-16-2002, 04:44 PM
damn, when editing admin/functions.php in vb 2.2.6


then look for

$lastposts=$DB_site->query_first("SELECT lastpost,lastposter FROM thread WHERE lastpost='$lastposts[lastpost]'");
$lastpost=$lastposts['lastpost'];
$lastposter=$lastposts['lastposter'];

change to

$lastposts=$DB_site->query_first("SELECT lastpost,lastposter,title FROM thread WHERE lastpost='$lastposts[lastpost]'");
$lastpost=$lastposts['lastpost'];
$lastposter=$lastposts['lastposter'];
$lasttitle=$lastposts['title'];


That part is not possible, so I can't install the hack.. any help with this?

dwh
08-16-2002, 05:58 PM
Originally posted by Boofo
Can you supply a screenshot?

Sorry, I only installed it in my test forum...and then deleted it...But it's the same exact screenshot as the other versions of this hack but with the same icon as the user selects showing up on the forumhome and forumdisplay.

dwh
08-16-2002, 06:01 PM
Originally posted by Webmasta XT
damn, when editing admin/functions.php in vb 2.2.6


then look for

$lastposts=$DB_site->query_first("SELECT lastpost,lastposter FROM thread WHERE lastpost='$lastposts[lastpost]'");
$lastpost=$lastposts['lastpost'];
$lastposter=$lastposts['lastposter'];

change to

$lastposts=$DB_site->query_first("SELECT lastpost,lastposter,title FROM thread WHERE lastpost='$lastposts[lastpost]'");
$lastpost=$lastposts['lastpost'];
$lastposter=$lastposts['lastposter'];
$lasttitle=$lastposts['title'];


That part is not possible, so I can't install the hack.. any help with this?

Yah, the original currently has that section wrong...I don't have the code in front of me but bascially you need to look for the section that say $lastpost=$DB_site...there's only one. The only part you need to worry about is to add "title" to the SELECT statement so instead of "SELECT lastpost,lastposter" it should be "SELECT lastpost,lastposter,title" and then add $lasttitle=$lastposts['title'] and you should be ok..but don't forget that in the template to fix that little error I mentioned $form['lasttitle'] should be $forum[lasttitle]

hope this helps..

Boofo
08-16-2002, 06:03 PM
I guess I'm still lost here. :confused: What icon did you use and where did you put it? Are you talking about the little arrow icon?

Originally posted by dwh


Sorry, I only installed it in my test forum...and then deleted it...But it's the same exact screenshot as the other versions of this hack but with the same icon as the user selects showing up on the forumhome and forumdisplay.

dwh
08-16-2002, 06:13 PM
Here's a screenshot :banana:

Boofo
08-16-2002, 06:21 PM
Ok, I understand now. LOL Thanks. :)

BTW: Who's crappy board is that? They ought to have their vB license revoked.

All seriousness aside now...could you have different icons for each one? And would it pick them from a group or is this all manual labor stuff?

Originally posted by dwh
Here's a screenshot :banana:

Webmasta XT
08-17-2002, 12:45 PM
can we get a new updated file? for ppl with vb 2.2.6?

Webmasta XT
08-17-2002, 12:53 PM
well, I got it working!

Boofo
08-21-2002, 01:19 AM
Any way to get this working in the Search > Thread Results screen? :)

Boofo
08-27-2002, 12:15 AM
Scott, did you ever figure out why when I have a user with an apostrophe in the name that when I run update counters on the forum, that it gives me a db error is the user with the apostrophe is the user with the last post? And every once in a while I get a thread that gives me an errorid error if I click on it but when I go to edit the thread, it fixes it so it is clickable again.

Scott MacVicar
08-27-2002, 12:33 AM
let me guess syntax error due to the lack of a slash. Can you post the query it was trying to run if possible.

Ill get an update file done soon, its changed in 2.2.7 so I'll have to post a new one.

Boofo
08-27-2002, 01:41 AM
Bingo on the syntax error. :) I don't remember the exact query. It was when I ran the Update Thread Counters in the Admin CP that I got it. Also, like I said above. Every so often, when I click on the link to the last post title, it gives me an errorid (no thread identified error) and if I open Edit thread for that thread and click save without doing anything else, it fixes it. :)

Boofo
08-27-2002, 05:57 AM
Scott, I've got an update to my problem here. This is the error I just got when I clicked on the link on the forum home to a new thread.

No thread specified. If you followed a valid link, please notify the Webmaster

When I went in to the thread, there was only the first post in it (the new thread post). I did a test message (so there are 2 posts now in the thread) and when I went back to the forumhome and clicked on the link again, this time it worked and took me to the first post. I then erased the second message (the test message) and now there is only the original post left in it. When I clicked on the link in the forumhome, it works fine again. It must have something to do with there only being one post in the thread or something. I'm just guessing here. :) Any ideas on this one?

Do you think you can do a small update to fix this and the apostrophe problems before the updated version for 2.2.7 comes out? :) I'm still using 2.2.5 and will be at least until version 3 comes out.

Boofo
08-31-2002, 07:34 PM
Scott, here is the db error I just got after clicking on the last post in one of the forums on the forumhome. Is there a way to fix it? :)

Database error in vBulletin 2.2.5:

Invalid SQL: SELECT threadid FROM post WHERE username='Boofo's Babe' AND dateline='1030675088'
mysql error: You have an error in your SQL syntax near 's Babe' AND dateline='1030675088'' at line 1

mysql error number: 1064

Date: Saturday 31st of August 2002 09:28:05 PM
Script: http://www.bearfacts2.com/forum/forum/showthread.php?s=&goto=newthread&forumid=23
Referer: http://www.bearfacts2.com/forum/index.php?s=

NTLDR
08-31-2002, 07:39 PM
Originally posted by Boofo
Scott, here is the db error I just got after clicking on the last post in one of the forums on the forumhome. Is there a way to fix it? :)

I don't know what query this is as I don't have the hack installed, but you need to addslashes to the username:

username='".addslashes($username)."'

$username is the part of the query that has the username it in, not sure what it is for this hack ;)

Scott MacVicar
08-31-2002, 09:16 PM
Is this with another hack Boofo because i dont have a link to goto=newthread in my showthread.php, though the addslashes it what is missing from the query.

Boofo
09-01-2002, 01:49 AM
I think I fixed it but I'm not sure if I did it right. :)

Here's the code I started out with:

// 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='$foruminfo[lastposter]' AND dateline='$foruminfo[lastpost]'"));
header("Location: showthread.php?s=$session[sessionhash]&threadid=$lastthread[threadid]");
exit;
}
}

And heres' what I changed it to:

// 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;
}
}

Also, I'm getting this error sometimes when I click on a last post on forumhome link. For some reason, when that happens, it isn't passing the threadid to the &threadid line. Any idea what could be causing that?

No thread specified. If you followed a valid link, please notify the Webmaster

Baptizer
09-02-2002, 06:51 PM
Hmm...
it seems as though this doesnt work for version 2.2.7..... :(
the section that involves:


look for
if ($lastpost!=$currentlastpost) {
$lastpostquery=",lastpost='$lastpost',lastposter='".addslashes($lastposter)."'";
} else {
$lastpostquery="";
}

change to

if ($lastpost!=$currentlastpost) {
$lastpostquery=",lastpost='$lastpost',lastposter='".addslashes($lastposter)."',lasttitle='".addslashes($lasttitle)."'";
} else {
$lastpostquery="";
}

is not in 2.2.7...can smoeone help me? am i wasting my time?

N9ne
09-02-2002, 09:27 PM
Has anyone confirmed that this works flawlessly on 2.2.7?

Baptizer
09-02-2002, 09:47 PM
I compared the file from 2.2.6 to 2.2.7, and the code i mentioned is not in 2.2.7. I am thinking of going ahead with it anyhow, i really cannot live without the last post not showing up on the front forum page.....

I am guessing you havnt tried it yet?

Baptizer
09-03-2002, 12:22 AM
I think i might have got this working on 2.2.7.

How do i right justify the LAST TOPIC in the LAST POST column? mine are being centered, and my box is big!

Webmasta XT
09-04-2002, 11:59 PM
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

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


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
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?