View Full Version : Latest Threads On Forum Home
NTLDR
01-20-2004, 10:00 PM
Latest Threads On Forum Home
Version: 1.0.2
vB-version: 3.0.0 Release Candidate 2
Developer: NTLDR
Install-difficulty: 1
File-edits: 2
Template-edits: 1
Description of the Hack:
This is taken from my vBindex hack and will display the latest X threads on your forum home page. Permissions are done automatically so forums users can't view will be excluded. Includes thread icon/goto new post image (if the thread is unread), title, last post info, number of views and replies.
Files modified for this Hack:
index.php
New templates for this Hack:
forumhome_latestthreadbit
Templates modified for this Hack:
FORUMHOME
New phrases for this Hack:
latest_threads
muchas gracias senior!!
/me clicks first to install
ChrisSy
01-21-2004, 01:58 PM
great work thanks, now just need a way to get it into my sidebar :)
thanks
KuraFire
01-21-2004, 02:34 PM
I take it you're enjoying the HTL ? :)
NTLDR
01-21-2004, 02:43 PM
It was alot easier figuring out howto create the HTL install instrctions then trying to make a text file look clear and easy. Once its released I'll provided an updated HTL version :)
KuraFire
01-21-2004, 03:26 PM
It was alot easier figuring out howto create the HTL install instrctions then trying to make a text file look clear and easy. Once its released I'll provided an updated HTL version :)
Which will be even easier, still! :)
Don't forget to change the title of the thread (when you go for a HTL installer) to have the [HTL] prefix, to denote that it has a .htl installer file. Makes for much easier checking out for people who want to see which hacks are HTL-hacks :)
(of course, you're free not to do it, but hey, it helps people, and it's not that big a hassle ;))
Where would I change how many recent threads are displayed?
NTLDR
01-21-2004, 04:07 PM
Add ABOVE that:
Note: Change 5 in this part of the query to change the number of threads to show: DESC LIMIT 5
Change ORDER BY lastpost to ORDER BY dateline to stop it showing threads with new posts.
^^ See that comment above the relevent section of code in the install instructions.
^^ See that comment above the relevent section of code in the install instructions.
* WAR blushes for missing that
Your level of support for your hacks is amazing!
Thanks alot
Good job! I could use this one!
/me clicks Install
MGM out
Goyko
01-22-2004, 10:15 AM
Hi NTLDR,
I love this hack!
Anyway - Some problems resist:
Collapsing this section collapses it. <- o.k.
BUT - it doesn't remember the status (collapsed/uncollapsed)
To be honest, it's acting very weird ... sometimes the icon doesn't change... sometimes it's the wrong icon... sometimes it stays collapsed... sometimes not.
And if there was no post icon chosen for the post it shows a broken image link in front of every thread listed in the box.
Maybe you give it a try and recheck those issues?
Would be great to use this hack fully functional!
Thanks!
btw: I'm using it with the RC3 version. But I guess that couldn't be it?!
Best regards...
Goyko
NTLDR
01-22-2004, 11:44 AM
In your FORUMHOME template find:
style="$vbcollapse[collapseobj_forumhome_threads]">
Replace with:
style="$vbcollapse[collapseobj_forumhome_latestthreads]">
That should fix the expand/collapse issue.
Do you have a default icon specified in your options? If so what have you entered there?
Goyko
01-22-2004, 05:01 PM
In your FORUMHOME template find:
style="$vbcollapse[collapseobj_forumhome_threads]">
Replace with:
style="$vbcollapse[collapseobj_forumhome_latestthreads]">
That should fix the expand/collapse issue.
Works perfectly! Thank you very much!!!
Do you have a default icon specified in your options? If so what have you entered there?
Err..... to be honest I can't find this option.
Can you gimme a hint, where to look for it?
Best regards
Goyko
NTLDR
01-22-2004, 05:25 PM
ACP -> vBulletin Options -> Thread Display Options (showthread) -> Show Default Post Icon
I assume its still there in post Gamma versions.
Goyko
01-22-2004, 05:37 PM
ACP -> vBulletin Options -> Thread Display Options (showthread) -> Show Default Post Icon
I assume its still there in post Gamma versions.
Oh .. I was looking for a radio button :ermm:
Yes I have entered "images/icons/icon1.gif" in this field.
And the icon exists.
But ... shame on me :rolleyes:... the problem is NOT the default icon!
There are only problems, if an icon has been chosen for the post!
So it's the exact opposite, from what I was telling before.
Weird!
Sorry for misleading you ... should have observed more carefully!
Best regards...
Goyko
NTLDR
01-22-2004, 06:33 PM
OK, this should fix it:
Find this code in index.php
if ($thread['iconid']) {
$show['icon'] = true;
$thread['threadiconpath'] = &$iconcache["$thread[threadiconid]"]['iconpath'];
$thread['threadicontitle'] = &$iconcache["$thread[threadiconid]"]['title'];
} elseif (!empty($vboptions['showdeficon'])) {
$show['icon'] = true;
$thread['threadiconpath'] = $vboptions['showdeficon'];
$thread['threadicontitle'] = $vbphrase['default'];
}
Replace it with:
$icon = fetch_iconinfo($thread['iconid']);
if (is_array($icon)) {
$show['icon'] = true;
$thread['threadiconpath'] = $icon['iconpath'];
$thread['threadicontitle'] = $icon['title'];
}
That should fix it :)
Goyko
01-22-2004, 07:14 PM
All it does, is leading to a parse error on line 464 :(
Greez
Goyko
NTLDR
01-22-2004, 07:20 PM
Whats on line 464?
Goyko
01-22-2004, 07:32 PM
Never mind :rolleyes:
I forgot a closing ";" at the end.
Now going to check if it works.
Goyko
Edit:
Now it works!
Thanks very much!
StarBuG
01-23-2004, 08:48 AM
Thank you for making this hack!
You should put your Icon FIX into the installer cause I had the same problem!
After the fix it seems to worked with the icons
HOWEVER why can I see postings made in my developer section when I?m loged out?
Only Admins and Developers have access there!???
I thought the permissions where checked before displaying?
* StarBuG clicks install but hopes the fix for permissions comes soon
StarBuG
NTLDR
01-23-2004, 09:07 AM
I can't confirm this, I've just tested this code again and it excludes the forums I don't have access to. Are you sure you setup the permissions correctly? This checks the canview and can view others permissions for each forum.
StarBuG
01-23-2004, 09:16 AM
<a href="http://www.hiphop-battles.com/forum/index.php" target="_blank">http://www.hiphop-battles.com/forum/index.php</a>?
Can you please go there and tell me wich 5 threads you see last posted?
I´ve already checked the permissions. Guest have all NO in these category and the subforums are inharited
Greetings
Star
NTLDR
01-23-2004, 09:26 AM
There are threads that I don't have access to, I looked before I double checked the code. Do you have any other changes made to index.php? I've been using this code for 7 months now with no problems.
Upload the attached file and run it as a user of various groups, it should print a list of all the forums you don't have access to. Try it as a guest and see if it mentions the forums that appear on the latest threads.
StarBuG
01-23-2004, 09:31 AM
No Access To Forum ID: 14 (Mod Cat)
No Access To Forum ID: 15 (Mod)
No Access To Forum ID: 11 (Dev Cat)
No Access To Forum ID: 12 (Dev)
No Access To Forum ID: 13 (Dev)
That are exactly the forums I don´t want guests to have in
But I still can see the posts from these forums!
I made some changes in index (users only last 24 hours) but I don´t think that this is the reason for the problem cause there is nothing related to permissions
Any ideas?
Greetings
Star
Goyko
01-23-2004, 11:18 AM
I can confirm the problem, Starbug is talking about!
It includes the forums, I have NO access to, lists the new posts, but if I click on an entry, it tells me, that I don't have access to view it.
Shouldn't be even visible!
Best regards.
Goyko
NTLDR
01-23-2004, 12:10 PM
Turn on debug mode, add $debug = 1; in config.php and then visit index.php?showqueries=1 and look for the query smimilar to what you added to index.php, in particular this bit:
AND forumid NOT IN (0)
It should be 0,X,Y,Z where each of the letters represents a forum that your not allowed to view. If its just got 0 then I'll rework the code.
StarBuG
01-23-2004, 12:17 PM
I added the line to the config.php but nothing showed up at index.php?showqueries=1
But the debug mode is on cause I have the drop down below my forum and wich templates where called (I deactivated it again)
Do I have to do something in AdminCP as well?
Star
NTLDR
01-23-2004, 12:19 PM
Click the 'Explain' link, it does a similar thing.
StarBuG
01-23-2004, 12:22 PM
It only shows up an empty page!
I leave it on for you to check
Hope you can help me
You can see the hacks I´ve installed in my news forum (but only the useronline required editing the index.php)
Greetings
Star
NTLDR
01-23-2004, 12:23 PM
Change:
$limitfids = ','.$forum['forumid'];
To:
$limitfids .= ','.$forum['forumid'];
I missed a . out.
NTLDR
01-23-2004, 12:23 PM
It only shows up an empty page!
Well it works fine for me, I just viewed it on your site :) Regardless the above change will fix the issue :)
StarBuG
01-23-2004, 12:25 PM
YES
It works!!!
PERFECT!
Thank you very much for the fast support
StarBuG
Goyko
01-23-2004, 12:30 PM
YES
Thank you very much for the fast support
StarBuG
From me too !!!
Now it does work perfectly!
Thanks for this great hack!
Best regards
Goyko
dutchbb
01-24-2004, 12:45 PM
how many queries does it add? thanks
mharmon
01-24-2004, 04:37 PM
Great Thread! :)
i`d love to see that panel just under navbar i was trying to put it there but colapse doesn`t work so far... :( any chanse for help?
NTLDR
01-24-2004, 09:31 PM
Make sure you copy all the HTML and place it within a table under the navbar.
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="70%" align="center">
code from zip
</table>
thanx a lot! very quick ;) one more question - how to make more letters to be awailable from thread name? I mean now it look like:
New thread Last post: today 21:11 from M.C. replyes: 5 >> views: 10
New thread abou... Last post: today 21:11 from M.C. replyes: 5 >> views: 10
I want to see more here like: New thread about new style...
Where to change amount of letters?
Thanks!
NTLDR
01-24-2004, 09:57 PM
In index.php find:
$thread['title'] = fetch_censored_text(fetch_trimmed_title(unhtmlspec ialchars($thread['title']), 22));
Change 22 to the number of characters you want.
Thanks a million! Great job! Click install! Good Luck!
dutchbb
01-25-2004, 07:21 AM
how many queries does it add? thanks
anyone?
zeeg99
01-25-2004, 07:37 AM
I had issues with it also with the icon images, I uninstalled it for now though =)
StarBuG
01-25-2004, 08:37 AM
See post #16 there you´ll find the fix for the icon problem!
Greetings
Star
SuperG
01-25-2004, 04:20 PM
This is kinda the hack I've been looking for, only if it was to display latest threads on a non-vb page. Is there an easy modification to this to show up on non-vb pages?
Thanks in advance for any help.
NTLDR
01-25-2004, 04:32 PM
Adds one query to forumhome.
If you want these on a non vB page you just need to inlcude vB's global.php and inlcude my code in your PHP. Alternativly use the RSS system thats included with vB, but thats beyond the scope of this thread ;)
SuperG
01-25-2004, 06:41 PM
This is what I did:
1.) I've included global.php because I have a login on my external pages.
2.) I put the globaltemplates=array stuff that you have in your first step.
3.) I wasn't sure where to put the code that started with // START HACK='Latest Threads On Forum Home' AUTHOR='NTLDR' VERSION='1.0.0' CHANGEID= 2 . Where would I put that?
4.) I created the template.
5.) I created the phrase.
What now? I'm pretty sure I didn't put the code mentioned above in the right place because my stuff's not working.
Just a note, I'm using this in root, not /forums. Anyhow, thanks for any help you can offer. :-)
i`ve got one small problem:
it`s start look like that and funny thing i didn`t change anything since i install that hack... see attach.
more funny is that on my other test board everything OK. i checked templates - same code but... and few minutes late evrething wnt back ok.... what da hell is that? :ermm:
NTLDR
01-25-2004, 09:25 PM
@SuperG: Put the code just above the following in global.php so its run on everypage and you could be able to add the $threadbits variable in any of the templates:
// parse some global templates
If vB use that variable on any page then you'll need to change this line:
eval("\$threadbits .= \"".fetch_template('forumhome_latestthreadbit')."\";");
And replace $threadbits with something unique like $my_latest_threads for example and change the variable in the template accordingly.
@M.C. No idea why it should suddenly do that I'm affraid.
SuperG
01-25-2004, 09:52 PM
I just get parse errors in everything. maybe i'm just not cut out for this :-\ ARG
NTLDR, i`ve dot no idia eather.... only one thing i got - when i open forumhome - it1s like that, but when i surf in forum and then coming back on forumhome everything ok... strange...
NTLDR
01-25-2004, 10:18 PM
The only way you'll get parse errors is if you cut and paste the code wrong, make sure it appears exactly as its shown onscreen :)
KuraFire
01-25-2004, 10:24 PM
The only way you'll get parse errors is if you cut and paste the code wrong, make sure it appears exactly as its shown onscreen :)
hey, you can release the HTL version now, NTLDR! ;)
SuperG
01-25-2004, 10:59 PM
1.) Included global.php in my non-vb root page.
2.) Add the templates in global.php under where the comment says "// templates to be included in every single page..."
3.) I added the code per your instructions about "// ### ALL DONE! SPIT OUT THE HTML AND LET'S GET OUTA HERE... ###"
4.) I added what I was suppose to add on FORUMHOME to my non-vb page.
5.) I created the template.
6.) I created the phrase.
Now, I upload, and I can't get past the Fatal error: Call to undefined function: fetch_iconinfo() in /home/paintbal/public_html/forums/global.php on line 524
I'm not really sure what I'm doing (because I'm not all that familiar with what I'm trying to do here), so newb instructions would be awesome.
Sorry for the inconvenience, and THANKS for the help!!!
Matthew
NTLDR
01-26-2004, 10:39 AM
Posting the exact error allways helps ;)
Above the code your adding from this hack put the following line:
require_once('./includes/functions_forumlist.php');
MischiefThought
01-26-2004, 10:57 AM
How do i do the last step? *Feels really stupid*
Create a new phrase called latest_threads in the GLOBAL group with the following content:
Im still new to vb3, lol. Please bare with me!
MischiefThought
01-26-2004, 11:05 AM
Figured it out! hehe
NTLDR, back to our sheeps.... look what heppend then (see attaches). When I just coming in it shows me like i post it before (i move attach in that post for skip skrolling ;))... then, when i start visit new threads they jump in right place, but unvisited still stay in wrong (second tumb.), and finaly, when i visit last new thread evrething on right place, so... i think that is NOT browser bug and i think it happend only when i have just few new threads and there is new and all threads together in list.... any ideas?
NTLDR
01-26-2004, 01:37 PM
If you have changed the forumhome_latestthreadbit from the default one in the zip can you post its contents here in [html] tags as well as the code you have in the FORUMHOME template that you added for it and I'll look into it.
i think i find mistake... it`s mine :devious: ... when i was changin table i removed left column, but in forumhome_latestthreadbit i fogrot on </td>
sorry for worrying... Good Luck!
SuperG
01-26-2004, 10:17 PM
I add that right under global.php, and its having the same error.
NTLDR
01-26-2004, 10:22 PM
That line needs to go in global.php above the code you added for this hack :)
SuperG
01-26-2004, 11:31 PM
Dar! Ok, works beautifully now. You rule!
NTLDR, i made small add-on for hack (template modification), wich make threads with new post bold and threads without no. May be someone likes it:
in template forumhome_latestthreadbit find:
<a href="showthread.php?$session[sessionurl]threadid=$thread[threadid]" title="$thread[preview]"><strong>$thread[title]</strong></a>
and replace with:
<if condition="$show['firstnew']"><a href="showthread.php?$session[sessionurl]threadid=$thread[threadid]" title="$thread[preview]"><strong>$thread[title]</strong></a><else /><a href="showthread.php?$session[sessionurl]threadid=$thread[threadid]" title="$thread[preview]">$thread[title]</a></if>
Is any chanse to make bold sticky threads and show sticky sign or icon for them?
Good Luck
NTLDR
01-27-2004, 10:22 PM
<if condition="$thread['sticky'] == 1">image code here</if>
Obviously replacing image code here with the actual code for your sticky image ;)
thanks, i was thinking it`s gonna be easy ;)
obiwan8472
01-28-2004, 11:12 PM
Brilliant hack.. but how do I make it only choose the threads from one certain forum.. and not the others?
mharmon
01-30-2004, 08:29 PM
NTLDR : Does this do anything to server load?
NTLDR
01-30-2004, 08:30 PM
Adds one query to forumhome, so you shouldn't notice any decrease in performance.
Goyko
02-10-2004, 10:47 AM
Hi there again,
I just figured out, that the hack doesn't display closed threads :(
Would be useful, if it would do this, because from time to time I post new threads and afterwards close them at once.
Those posts should be visible there too .. don't you think so?
Any idea, how to fix that?
Thanks in advance!
Best regards...
Goyko
NTLDR
02-10-2004, 02:14 PM
Remove the section that looks like AND open <> 1 in the code you have added.
Goyko
02-10-2004, 10:33 PM
Remove the section that looks like AND open <> 1 in the code you have added.
???? :nervous:
Which code?
Where?
Sorry ... but could you please be a little more specific?
I'm a total non-programmer :)
Thanks!
Best regards...
Goyko
Papino
02-15-2004, 12:14 AM
*installed
thx Lee :)
clubcivic.com
02-22-2004, 01:33 PM
Brilliant hack.. but how do I make it only choose the threads from one certain forum.. and not the others?
I would like to know this as well. btw... great hack :up:
sorry again... how can i exclude threads from some forums wich i don`t want to show? I mean without forum permissions.
For example:
1. Forum1 is tech forum (open for all) and post from it can be shown in Last Posts box.
2. Forum2 is flood/flame forum (open for all as well) BUT i don`t want to show post from it to anybody in Last Posts box!
i was trying to change forumid here, but it doesn`t work:
AND forumid NOT IN (0$limitfids)
Thanks!
added
to show closed threads i guess you should change:
WHERE open = '1'
to:
WHERE open = '0'
or delete that line at all.
NTLDR
02-24-2004, 06:09 PM
Change:
AND forumid NOT IN (0$limitfids)
to:
AND forumid NOT IN (0,X,Y,Z$limitfids)
changing X,Y,Z to the forumids, note the lack of a comma after Z.
To show closed threads removed the open = '1' and the AND which should be on the line after it.
perfect! thanx a lot....
if it possible (only if you really want to do that) i`d love to see one more thing:
I have Forum Home Page with your Last Threads box - that is Home Page for one site forum (http://www.mysite.com/forum). Then, i have forum (for example ID=2), which i use as Forum Home Page for other site bbs (http://www.mysite.com/forum/?f=2). So it`s look like Forum Home Page also and has same Last Threads box.
Now, i`d love to see on original Forum Home Page your Last Threads box but exclude threads from foumid=2 (like you said me above). BUT, when i use my second Forum Home Page i`d love to see Last Threads ONLY from that forum and subforums...
Is it possible?
I don`t push at you with that mod, but if you`ll make it it`ll be amazing!
Good Luck!
Sorry for my english....
Chris M
02-25-2004, 10:34 AM
Nice hack Mr Lee :)
Installed on DB :)
Satan
NTLDR
02-25-2004, 01:21 PM
Now, i`d love to see on original Forum Home Page your Last Threads box but exclude threads from foumid=2 (like you said me above). BUT, when i use my second Forum Home Page i`d love to see Last Threads ONLY from that forum and subforums...
Find and replace the following Line (I know you've edited this so this is what it looks like in the install file:
AND forumid NOT IN (0$limitfids)
with:
".iif($_REQUEST['forumid'] == 2, 'AND forumid = 2', "AND forumid NOT IN (2,X,Y,Z$limitfids)")."
X,Y,Z are those forumids which you wanted exluded before.
ok. i`ll check it tonight! thanks a million ;)
added
no... that make only dissapear Last Trheads box for forum=2
SoLo OnE
02-26-2004, 07:36 PM
Is there any way to carry this to all the other forum pages??
Create a new phrase called latest_threads in the GLOBAL group with the following content:
i don't know how to do that, can someone help me?
MindTrix
03-13-2004, 04:16 PM
Log into your admin cp and down the left handside you should find Phrase manager. Click on add new phrase, the rest should be straight forward
DrScion
03-17-2004, 02:15 AM
Wicked cool, very easy install. Very pleased with hack.
djohn
03-28-2004, 01:03 PM
Nice hack, i just wanterd to know, how can i remove that small and unused cell on the right? In the stats block, stats.gif image is displayed there, but in your hack it is empty. How can i remove it?
NTLDR
03-28-2004, 03:47 PM
Just edit the templates to make it span two columns.
djohn
03-28-2004, 04:21 PM
What templates, and how exactly should I edit them? I'm not very familiar with coding and stuff.
djohn
03-30-2004, 03:40 PM
Still no progress. I've tried anything, but apparently, there seems to be some chunk of code above urs that messes everything up.. :( Can you take a look?
Flugel
04-05-2004, 01:04 PM
Forgive my ignorance, but I've followed the install instructions to the letter and Latest Threads table is not appearing on my forum homepage. Any ideas?
esfron
04-16-2004, 04:51 PM
Is there a way to exclude forums from the newest replies on a basis forum by forum with something like //$excludedforums = "13"; // forums to be excluded from latest threads. Format "0,5,7"//.
Thanks
Hi Lee,
I looked at your code and I think there is a problem with your hack.
You are doing full table scans and that process is known as being extremly stressfull for the server.
Your search for latest threads should generate at least a 70% MySQL activity...
IMO is extremly high. Let me know what you think.
Regards,
Floren.
dutchbb
04-27-2004, 01:17 PM
Latest Threads On Forum Home
Can this be set by usergroup? And how would I do that please.
Great hack!
dutchbb
04-27-2004, 01:19 PM
Hi Lee,
I looked at your code and I think there is a problem with your hack.
You are doing full table scans and that could easily crash your server in a busy site.
Your search for latest threads should generate at least a 70% MySQL activity...
IMO is extremly high. Let me know what you think.
Regards,
Floren.
Hm doesn't sound good, interested in what he has to say...
NTLDR
04-27-2004, 01:20 PM
Can this be set by usergroup? And how would I do that please.
Great hack!
You mean only display the latest threads block for certain groups?
dutchbb
04-28-2004, 02:27 PM
You mean only display the latest threads block for certain groups?
Yes, like only for paid membership groups.
Is it true what Teck said?
NTLDR
04-28-2004, 02:37 PM
Replace:
// [START HACK='Latest Threads On Forum Home' AUTHOR='NTLDR' VERSION='1.0.0' CHANGEID= 2 ]
// #################### PROCESS LATEST THREADS #######################
// fetch the permissions for each forum
$forumperms = array();
foreach($forumcache AS $forum) {
$forumperms["$forum[forumid]"] = fetch_permissions($forum['forumid']);
// ## HIDE FORUMS WITHOUT THE CANVIEW OR CANVIEWOTHERS PERMISSION ##
if (!($forumperms["$forum[forumid]"] & CANVIEW) || !($forumperms["$forum[forumid]"] & CANVIEWOTHERS)) {
$limitfids .= ','.$forum['forumid'];
}
}
unset($forum);
if ($vboptions['threadpreview'] > 0) {
$previewfield = ', post.pagetext AS preview';
$previewjoin = 'LEFT JOIN '.TABLE_PREFIX.'post AS post ON(post.postid = thread.firstpostid)';
}
$getthreads = $DB_site->query("
## GET LATEST THREADS ##
SELECT thread.*,thread.iconid AS threadiconid $previewfield
FROM ".TABLE_PREFIX."thread AS thread
LEFT JOIN ".TABLE_PREFIX."deletionlog AS deletionlog ON(thread.threadid = deletionlog.primaryid AND type = 'thread')
$previewjoin
WHERE open = '1'
AND forumid NOT IN (0$limitfids)
AND thread.visible = '1'
AND deletionlog.primaryid IS NULL
ORDER BY lastpost
DESC LIMIT 5");
while($thread = $DB_site->fetch_array($getthreads)) {
$threads = true;
$thread['title'] = fetch_censored_text(fetch_trimmed_title(unhtmlspec ialchars($thread['title']), 22));
$thread['date'] = vbdate($vboptions['dateformat'], $thread['lastpost'], 1);
$thread['time'] = vbdate($vboptions['timeformat'], $thread['lastpost']);
$thread['preview'] = preg_replace('#\[quote(=("|"|\'|).*\\2)?\](.*)\[/quote\]#siU', '', $thread['preview']);
$thread['preview'] = htmlspecialchars_uni(fetch_trimmed_title(strip_bbc ode(fetch_censored_text($thread['preview']), false, true), $vboptions['threadpreview']));
$thread['replycount'] = vb_number_format($thread['replycount']);
$thread['views'] = vb_number_format($thread['views']);
// thread icon
$show['icon'] = false;
$icon = fetch_iconinfo($thread['iconid']);
if (is_array($icon)) {
$show['icon'] = true;
$thread['threadiconpath'] = $icon['iconpath'];
$thread['threadicontitle'] = $icon['title'];
}
// show goto new post
$show['firstnew'] = false;
$bbforumview = fetch_bbarray_cookie('forum_view', $thread['forumid']);
if ($bbforumview > $bbuserinfo['lastvisit']) {
$lastread = $bbforumview;
} else {
$lastread = $bbuserinfo['lastvisit'];
}
if ($thread['lastpost'] > $lastread) {
$threadview = fetch_bbarray_cookie('thread_lastview', $thread['threadid']);
if ($thread['lastpost'] > $threadview) {
$show['firstnew'] = true;
$show['icon'] = false;
}
}
exec_switch_bg();
eval("\$threadbits .= \"".fetch_template('forumhome_latestthreadbit')."\";");
}
if ($threads) {
$show['latestthreads'] = true;
}
// memory saving
unset($thread, $threads);
$DB_site->free_result($getthreads);
// [END HACK='Latest Threads On Forum Home' AUTHOR='NTLDR' VERSION='1.0.0' CHANGEID= 2 ]
With: (Changing X to the usergroupid you wish to show it for
if (is_member_of($bbuserinfo, X) {
// [START HACK='Latest Threads On Forum Home' AUTHOR='NTLDR' VERSION='1.0.0' CHANGEID= 2 ]
// #################### PROCESS LATEST THREADS #######################
// fetch the permissions for each forum
$forumperms = array();
foreach($forumcache AS $forum) {
$forumperms["$forum[forumid]"] = fetch_permissions($forum['forumid']);
// ## HIDE FORUMS WITHOUT THE CANVIEW OR CANVIEWOTHERS PERMISSION ##
if (!($forumperms["$forum[forumid]"] & CANVIEW) || !($forumperms["$forum[forumid]"] & CANVIEWOTHERS)) {
$limitfids .= ','.$forum['forumid'];
}
}
unset($forum);
if ($vboptions['threadpreview'] > 0) {
$previewfield = ', post.pagetext AS preview';
$previewjoin = 'LEFT JOIN '.TABLE_PREFIX.'post AS post ON(post.postid = thread.firstpostid)';
}
$getthreads = $DB_site->query("
## GET LATEST THREADS ##
SELECT thread.*,thread.iconid AS threadiconid $previewfield
FROM ".TABLE_PREFIX."thread AS thread
LEFT JOIN ".TABLE_PREFIX."deletionlog AS deletionlog ON(thread.threadid = deletionlog.primaryid AND type = 'thread')
$previewjoin
WHERE open = '1'
AND forumid NOT IN (0$limitfids)
AND thread.visible = '1'
AND deletionlog.primaryid IS NULL
ORDER BY lastpost
DESC LIMIT 5");
while($thread = $DB_site->fetch_array($getthreads)) {
$threads = true;
$thread['title'] = fetch_censored_text(fetch_trimmed_title(unhtmlspec ialchars($thread['title']), 22));
$thread['date'] = vbdate($vboptions['dateformat'], $thread['lastpost'], 1);
$thread['time'] = vbdate($vboptions['timeformat'], $thread['lastpost']);
$thread['preview'] = preg_replace('#\[quote(=("|"|\'|).*\\2)?\](.*)\[/quote\]#siU', '', $thread['preview']);
$thread['preview'] = htmlspecialchars_uni(fetch_trimmed_title(strip_bbc ode(fetch_censored_text($thread['preview']), false, true), $vboptions['threadpreview']));
$thread['replycount'] = vb_number_format($thread['replycount']);
$thread['views'] = vb_number_format($thread['views']);
// thread icon
$show['icon'] = false;
$icon = fetch_iconinfo($thread['iconid']);
if (is_array($icon)) {
$show['icon'] = true;
$thread['threadiconpath'] = $icon['iconpath'];
$thread['threadicontitle'] = $icon['title'];
}
// show goto new post
$show['firstnew'] = false;
$bbforumview = fetch_bbarray_cookie('forum_view', $thread['forumid']);
if ($bbforumview > $bbuserinfo['lastvisit']) {
$lastread = $bbforumview;
} else {
$lastread = $bbuserinfo['lastvisit'];
}
if ($thread['lastpost'] > $lastread) {
$threadview = fetch_bbarray_cookie('thread_lastview', $thread['threadid']);
if ($thread['lastpost'] > $threadview) {
$show['firstnew'] = true;
$show['icon'] = false;
}
}
exec_switch_bg();
eval("\$threadbits .= \"".fetch_template('forumhome_latestthreadbit')."\";");
}
if ($threads) {
$show['latestthreads'] = true;
}
// memory saving
unset($thread, $threads);
$DB_site->free_result($getthreads);
// [END HACK='Latest Threads On Forum Home' AUTHOR='NTLDR' VERSION='1.0.0' CHANGEID= 2 ]
}
I've had no problems running this code on several sites, though I may look into optimising it if and when I have time.
dutchbb
04-28-2004, 02:43 PM
Thanks for this very quick reply :)
I've had no problems running this code on several sites, though I may look into optimising it if and when I have time.
Lee, I hope you did not take it in a bad way my reflection, I was simply trying to help.
If you allow me, I will explain what is wrong with the code.
The query will perform a full scan from ALL forums and ALL threads. At this precise moment, the MySQL % will raise to the sky... for an instance the server will be suffocated with the flood of information it has to compile, in order to display the results, and that?s only for one person... imagine what will happen when 500 users will visit in the same time your front page.
A good rule to keep in mind for coders is: never perform full table scans.
If you have a very small forum with 200-300 posts, that will not really count, since your database is very small, but what do you do with huge forums who have 1 million posts?
Unfortunatelly, the 5 threads limit does not reduce the query scan at all, it will perform it, then grab only the latest 5 results.
What I recommend you to do is this: put a time/date limit in the query. In this way, instead of scanning the hole forum/thread tables, you select a very small portion of it.
The result is obvious, a very small database/server usage... :)
Regards,
Floren.
dutchbb
04-30-2004, 08:45 PM
With: (Changing X to the usergroupid you wish to show it for
if (is_member_of($bbuserinfo, X) {
// [START HACK='Latest Threads On Forum Home' AUTHOR='NTLDR' VERSION='1.0.0' CHANGEID= 2 ]
// #################### PROCESS LATEST THREADS #######################
// fetch the permissions for each forum
$forumperms = array();
foreach($forumcache AS $forum) {
$forumperms["$forum[forumid]"] = fetch_permissions($forum['forumid']);
// ## HIDE FORUMS WITHOUT THE CANVIEW OR CANVIEWOTHERS PERMISSION ##
if (!($forumperms["$forum[forumid]"] & CANVIEW) || !($forumperms["$forum[forumid]"] & CANVIEWOTHERS)) {
$limitfids .= ','.$forum['forumid'];
}
}
unset($forum);
if ($vboptions['threadpreview'] > 0) {
$previewfield = ', post.pagetext AS preview';
$previewjoin = 'LEFT JOIN '.TABLE_PREFIX.'post AS post ON(post.postid = thread.firstpostid)';
}
$getthreads = $DB_site->query("
## GET LATEST THREADS ##
SELECT thread.*,thread.iconid AS threadiconid $previewfield
FROM ".TABLE_PREFIX."thread AS thread
LEFT JOIN ".TABLE_PREFIX."deletionlog AS deletionlog ON(thread.threadid = deletionlog.primaryid AND type = 'thread')
$previewjoin
WHERE open = '1'
AND forumid NOT IN (0$limitfids)
AND thread.visible = '1'
AND deletionlog.primaryid IS NULL
ORDER BY lastpost
DESC LIMIT 5");
while($thread = $DB_site->fetch_array($getthreads)) {
$threads = true;
$thread['title'] = fetch_censored_text(fetch_trimmed_title(unhtmlspec ialchars($thread['title']), 22));
$thread['date'] = vbdate($vboptions['dateformat'], $thread['lastpost'], 1);
$thread['time'] = vbdate($vboptions['timeformat'], $thread['lastpost']);
$thread['preview'] = preg_replace('#\[quote(=("|"|\'|).*\\2)?\](.*)\[/quote\]#siU', '', $thread['preview']);
$thread['preview'] = htmlspecialchars_uni(fetch_trimmed_title(strip_bbc ode(fetch_censored_text($thread['preview']), false, true), $vboptions['threadpreview']));
$thread['replycount'] = vb_number_format($thread['replycount']);
$thread['views'] = vb_number_format($thread['views']);
// thread icon
$show['icon'] = false;
$icon = fetch_iconinfo($thread['iconid']);
if (is_array($icon)) {
$show['icon'] = true;
$thread['threadiconpath'] = $icon['iconpath'];
$thread['threadicontitle'] = $icon['title'];
}
// show goto new post
$show['firstnew'] = false;
$bbforumview = fetch_bbarray_cookie('forum_view', $thread['forumid']);
if ($bbforumview > $bbuserinfo['lastvisit']) {
$lastread = $bbforumview;
} else {
$lastread = $bbuserinfo['lastvisit'];
}
if ($thread['lastpost'] > $lastread) {
$threadview = fetch_bbarray_cookie('thread_lastview', $thread['threadid']);
if ($thread['lastpost'] > $threadview) {
$show['firstnew'] = true;
$show['icon'] = false;
}
}
exec_switch_bg();
eval("\$threadbits .= \"".fetch_template('forumhome_latestthreadbit')."\";");
}
if ($threads) {
$show['latestthreads'] = true;
}
// memory saving
unset($thread, $threads);
$DB_site->free_result($getthreads);
// [END HACK='Latest Threads On Forum Home' AUTHOR='NTLDR' VERSION='1.0.0' CHANGEID= 2 ]
}
Sorry to ask, can you give an example when using permission for 2 or more usergroups, I 'm not sure if and how to use the "OR" here
Dio Br@ndo
04-30-2004, 08:52 PM
Create a new phrase called latest_threads in the GLOBAL group with the following content:
i dont understand where create the phrase....can u explain me better pls?
and
$thread['views'] = vb_number_format($thread['views']);
doesnt works and show always 0 :ermm:
NTLDR
04-30-2004, 08:57 PM
Lee, I hope you did not take it in a bad way my reflection, I was simply trying to help.
Of course not, thanks for the input, I'll try and update the instructions with a more suitable query :)
NTLDR
04-30-2004, 08:58 PM
Create a new phrase called latest_threads in the GLOBAL group with the following content:
i dont understand where create the phrase....can u explain me better pls?
Admin CP -> Phrase Manager -> Add New Phrase
NTLDR
04-30-2004, 08:59 PM
Sorry to ask, can you give an example when using permission for 2 or more usergroups, I 'm not sure if and how to use the "OR" here
if (is_member_of($bbuserinfo, X) OR is_member_of($bbuserinfo, Y) OR is_member_of($bbuserinfo, W)) {
Dio Br@ndo
04-30-2004, 09:09 PM
thx 4 phrase.. :)
and for this problem?
$thread['views'] = vb_number_format($thread['views']);
doesnt works and show always 0 in home page :(
for this!
dutchbb
05-01-2004, 05:33 AM
if (is_member_of($bbuserinfo, X) OR is_member_of($bbuserinfo, Y) OR is_member_of($bbuserinfo, W)) {
You rock tnx
NTLDR
05-01-2004, 04:18 PM
doesnt works and show always 0 in home page :(
You've either opted not to update thread views straight away or have a problem with your board.
josh929
05-07-2004, 09:31 PM
Looks like an awesome hack! I want to install it, I just have a question:
Has this problem been resolved:
Hi Lee,
I looked at your code and I think there is a problem with your hack.
You are doing full table scans and that process is known as being extremly stressfull for the server.
Your search for latest threads should generate at least a 70% MySQL activity...
IMO is extremly high. Let me know what you think.
Regards,
Floren.
?
Does it still do a "full table scan"?
edit:
I realized that the original post has not been edited since this problem was pointed out. So I guess my question changes to: are there any plans to get rid of the "full table scan"? :)
NTLDR
05-08-2004, 06:37 PM
When I get the chance to update the hack I will.
Pitman
05-10-2004, 09:12 PM
Is there anyway to only include certain forums when listing?
Pitman
05-11-2004, 12:18 AM
Also, it would be cool if you were able to have sticky threads or something where you could show them about like the latest threads :)
NTLDR
05-11-2004, 11:53 AM
Just edit the SQL query to meet your needs.
Pitman
05-11-2004, 07:54 PM
Just edit the SQL query to meet your needs.
Lol... for someone like me, that is easier said then done ;)
Erwin
05-12-2004, 02:44 AM
This hack does do a full table scan - it would really push up the server loads if you have a lot of posts. For a smallish site it should not be a big problem.
WoodiE
06-23-2004, 05:04 AM
This hack does do a full table scan - it would really push up the server loads if you have a lot of posts. For a smallish site it should not be a big problem.
Any update on this not doing a full table scan? Also what would need to be done to this code to make it work with a sidebar that's shown through out the forum?
-Michael
Installed on my site .. took away the icon to make it tighter and neater.
Thanks for the hack
Take a look (http://www.thetechguys.co.uk/)
Clicks Install
RichieBoy67
06-30-2004, 11:54 PM
Can anyone give me a little assistance?? I installed it on one of my sites without a hitch. It installed in no time at all and looks perfect here www.talkandmore.net
On my other site www.speakoutonline.net the images are not loading... I've gone over my template edits 3 times and still it is messed up...Please help..
Thanks,
Rich
BTW-I tried using the fix in post 16 but couldn't find that code in my index.php-- There must be some kind of a conflict with another hack I have installed...I uninstalled the template for now until someone can help me..
RichieBoy67
07-01-2004, 09:34 PM
How did you take the icons away?? Which code did you remove???
Dead End Society
07-26-2004, 08:27 PM
Installed, I love it, but am having trouble getting my button to show up. What is the default button name so I can upload it?
Dead End Society
07-27-2004, 08:14 PM
*bump*
Has anyone installed a button? Anyone care to show me how? (like the birthday, stats, and who's online)
rex_b
08-12-2004, 06:57 PM
How did you take the icons away?? Which code did you remove???
turn the
$show['firstnew'] = false;
$show['icon'] = false; to false
rex_b
08-12-2004, 07:11 PM
I have a problem with the buttons not showing when I am logged in but when I am logged out they show. Any fix for this?
Frzzy
08-19-2004, 07:23 AM
What is this hack exactly do??? I fetch threads with the latest posts in it or latest threads made???
Zacharicus
10-05-2004, 12:34 PM
Thanks bigtime. I love it. I tweaked it abit, and it does exactly what I want.
Frzzy: Latest posts.
Zacharicus (www.intelligencenetwork.net)
Gutspiller
11-02-2004, 03:00 AM
Is it possible to move the readout to the top into my header and have control over which forums as well as whether or not replies, views, date, time, poster are displayed?
Archiseek.com
11-05-2004, 09:59 PM
Nice.... but is there a varient where i can pull the information out on to a html page?
ATLien
11-14-2004, 08:20 PM
I love this hack, but it displays thread that are in my private moderating forums. How can I fix this so only my public forum topics will show up?
Erwin
11-14-2004, 10:10 PM
Nice.... but is there a varient where i can pull the information out on to a html page?
Just use the inbuilt RSS function of vB3.
Morwyn
11-18-2004, 10:52 PM
Just one more correction. If you guys use vbadvanced (http://www.vbadvanced.com), you may want to modify the template to have the icons display correctly.
Go in your forumhome_latestthreadbit template that was created with the hack (the vbulletin.org one, latest threads) and replace:
<img src="$vboptions[bburl]/$thread[threadiconpath]" border="0" alt="$thread[threadicontitle]" title="$thread[threadicontitle]" style="vertical-align: text-middle" />
with:
<img src="$thread[threadiconpath]" border="0" alt="$thread[threadicontitle]" title="$thread[threadicontitle]" style="vertical-align: text-middle" />
See the $vboptions[bburl]/ that was erased ? That's it.
+ enter the full path of your default icon in the admin panel:
vbulletin options >> Thread display options
Reeve of shinra
11-19-2004, 02:26 AM
Is this intensive?
smdani
11-19-2004, 07:10 AM
Is it possible to move the readout to the top into my header and have control over which forums as well as whether or not replies, views, date, time, poster are displayed?
Hi NTLDR,
this hack is incredible, and I was looking for it all this time.
What I would like to do is what Gutspiller asked, to put last X threads updated in other web page. Is it possible.
I suggest you to create a Hack that:
1) Shows another link on 'QUICK LINKS' DHTML Menu named: 'Last updated threads'
2) Clicking this link will go to another web page where you can see last 25 Updated threads, and you can select there between 25/50/100
is this possible modifying your hack!
Thanks a lot again!
Morwyn
11-19-2004, 08:58 AM
Is this intensive?
What ? Vbadvanced or the latest threads hack ? Both of them have precise instructions so that's quite easy to install ;).
smdani
11-22-2004, 08:25 AM
Hi NTLDR,
How can I modify /modcp/index.php in order to appear last threads updated.
I tried but I obtained a lot errors.
I would like only moderators can see Last Threads updated.
Thanks a lot!
smdani
11-22-2004, 09:05 AM
Another question,
is it possible to show a little text, like NEW, close to the name of the thread showing if this updated thread has been read for the user or not.
I mean,
if thread has not been read by the user LAST THREADS will show 'NEW' afther the title of the thread.
:)
??This hack is what I was looking for!!
Reeve of shinra
11-22-2004, 11:47 AM
What ? Vbadvanced or the latest threads hack ? Both of them have precise instructions so that's quite easy to install ;).
No, I meant like server intensive.
smdani
11-22-2004, 12:26 PM
No, I meant like server intensive.
Only adds one more query to your FORUMHOME, it doesnt add almost server load.
RichieBoy67
11-25-2004, 01:31 PM
I'm not sure if this has already been covered in this thread so if it was... sorry. I don't have time today to search..
I just installed the rss hack and I don't want the bots posts to be posted. How can I fix this so they are not shown???
Thanks
Happy Turkey Day!
Rich
sstrayer
11-29-2004, 03:27 PM
Installed, thanks!
NiROE
12-31-2004, 08:14 AM
Cool mod, installed and working great.. Many thanks.. :squareeyed:
sbryan
01-02-2005, 10:41 AM
thanks, got this going in minutes, great hack and clicked on install.
its down the bottom at http://www.xboxworld.com.au/forum
just 2 questions.
1. Does the latest installer definately NOT allow it to display stuff from forums that only admins have access to, or will it show them, but only to admins?
2. Did it also install the 'Number of Active Users Today:' part as well? I've been away for a week but dont remember seeing that on my forum until now as well. (though i am a bit tipsy and it is almost midnight here so it could be just me)
Great hack, thanks again.
Michael2
01-03-2005, 03:11 PM
I'm trying this one out. Very easy to install. One question though... Is there a simple way to show threads from only one forum without having to exclude all of the forums you don't want listed?
iwk_batterio
01-08-2005, 06:39 PM
I found a little bug
If i write some html in a thread title (HTML off in board) vB will not display it, but the hack will! So it's possible to see some "strange" titles. However I think there aren't any security problems... but it's a bug and i'd like if you could fix it.
Thanks
I have 4 forum category's with rss feeds .. can I remove them from the list of forum ID's to be included with the Latest forum topics ?
zurih
01-12-2005, 09:40 AM
need some help :)
How can I include the forum names where the threads located?
thanks
zurih
01-12-2005, 08:04 PM
ok thanks to rake the overload problem of the server because of the search in the whole table has been solved!
he helped me to config the code so the last threads will be taken from a defined time.
here is a link
https://vborg.vbsupport.ru/showthread.php?t=74252
thanks again rank
teamgofast
01-15-2005, 03:38 AM
installed thanks!!!
L-Mane
01-17-2005, 03:22 AM
Oh .. I was looking for a radio button :ermm:
Yes I have entered "images/icons/icon1.gif" in this field.
And the icon exists.
But ... shame on me :rolleyes:... the problem is NOT the default icon!
There are only problems, if an icon has been chosen for the post!
So it's the exact opposite, from what I was telling before.
Weird!
Sorry for misleading you ... should have observed more carefully!
Best regards...
Goyko
I installed this but the 5th image is showing up broken and the link is this http://www.wordofsouth.com/myblock/http://www.wordofsouth.com/myblock/images/icons/cool.gif
it shows twice. Why is that?
Love it! Thank you for a great hack. :D
L-Mane
02-14-2005, 09:41 PM
Love it! Thank you for a great hack. :D
Parse error: parse error, unexpected $ in /home/**/***/******/index.php on line 453
hendri
02-26-2005, 08:17 AM
Parse error: parse error, unexpected $ in /home/**/***/******/index.php on line 453
i love this hack and i have seen the instruction but i even can't find 'forumhome_subforumseparator_post' in my index.php file ??? i used vb 3.07 can help ?
hendri
Eagle Creek
02-28-2005, 09:57 PM
DOES IT work on 3.0.7?
James Collins
03-01-2005, 01:50 AM
yes it does
Eagle Creek
03-01-2005, 11:38 AM
yes it does
Perfect!
Thx.
SkyShadow
03-05-2005, 08:46 AM
Can somebody tell me how I would display the latest threads in a sidebar instead?
ProperMethodz
03-30-2005, 03:59 AM
Hi... I'm really frustrated. This will be the second hack I am attempting to install, and isn't going so well.
I followed your instrctions to a "t" and am getting a parse error. I read through this entire thread and found where you say that it can only happen if you copy and paste the code incorrectly. Yet I still get the following error:
Parse error: parse error, unexpected T_STRING in /home/xhmgami/public_html/forum/index.php on line 460
I'm pretty damn sure I did it correctly.
I found my file and saved to desktop. I made a copy and opened in DW.
I then did a search for 'forumhome_subforumseparator_post', in DW this was RED and was towards the top of the page on line 49 <--- given to me by DW.
I then highlighted that line and replaced it with everything here:
// [START HACK='Latest Threads On Forum Home' AUTHOR='NTLDR' VERSION='1.0.0' CHANGEID= 1 ]
'forumhome_subforumseparator_post',
'forumhome_latestthreadbit'
// [END HACK='Latest Threads On Forum Home' AUTHOR='NTLDR' VERSION='1.0.0' CHANGEID= 1 ]
From there I searched for:
// ### ALL DONE! SPIT OUT THE HTML AND LET'S GET OUTA HERE... ###
It found one instance at the bottom. I then put my cursor above that line and pasted:
// [START HACK='Latest Threads On Forum Home' AUTHOR='NTLDR' VERSION='1.0.0' CHANGEID= 2 ]
// #################### PROCESS LATEST THREADS #######################
// fetch the permissions for each forum
$forumperms = array();
foreach($forumcache AS $forum) {
$forumperms["$forum[forumid]"] = fetch_permissions($forum['forumid']);
// ## HIDE FORUMS WITHOUT THE CANVIEW OR CANVIEWOTHERS PERMISSION ##
if (!($forumperms["$forum[forumid]"] & CANVIEW) || !($forumperms["$forum[forumid]"] & CANVIEWOTHERS)) {
$limitfids .= ','.$forum['forumid'];
}
}
unset($forum);
if ($vboptions['threadpreview'] > 0) {
$previewfield = ', post.pagetext AS preview';
$previewjoin = 'LEFT JOIN '.TABLE_PREFIX.'post AS post ON(post.postid = thread.firstpostid)';
}
$getthreads = $DB_site->query("
## GET LATEST THREADS ##
SELECT thread.*,thread.iconid AS threadiconid $previewfield
FROM ".TABLE_PREFIX."thread AS thread
LEFT JOIN ".TABLE_PREFIX."deletionlog AS deletionlog ON(thread.threadid = deletionlog.primaryid AND type = 'thread')
$previewjoin
WHERE open = '1'
AND forumid NOT IN (0$limitfids)
AND thread.visible = '1'
AND deletionlog.primaryid IS NULL
ORDER BY lastpost
DESC LIMIT 5");
while($thread = $DB_site->fetch_array($getthreads)) {
$threads = true;
$thread['title'] = fetch_censored_text(fetch_trimmed_title(unhtmlspec ialchars($thread['title']), 22));
$thread['date'] = vbdate($vboptions['dateformat'], $thread['lastpost'], 1);
$thread['time'] = vbdate($vboptions['timeformat'], $thread['lastpost']);
$thread['preview'] = preg_replace('#\[quote(=("|"|\'|).*\\2)?\](.*)\[/quote\]#siU', '', $thread['preview']);
$thread['preview'] = htmlspecialchars_uni(fetch_trimmed_title(strip_bbc ode(fetch_censored_text($thread['preview']), false, true), $vboptions['threadpreview']));
$thread['replycount'] = vb_number_format($thread['replycount']);
$thread['views'] = vb_number_format($thread['views']);
// thread icon
$show['icon'] = false;
$icon = fetch_iconinfo($thread['iconid']);
if (is_array($icon)) {
$show['icon'] = true;
$thread['threadiconpath'] = $icon['iconpath'];
$thread['threadicontitle'] = $icon['title'];
}
// show goto new post
$show['firstnew'] = false;
$bbforumview = fetch_bbarray_cookie('forum_view', $thread['forumid']);
if ($bbforumview > $bbuserinfo['lastvisit']) {
$lastread = $bbforumview;
} else {
$lastread = $bbuserinfo['lastvisit'];
}
if ($thread['lastpost'] > $lastread) {
$threadview = fetch_bbarray_cookie('thread_lastview', $thread['threadid']);
if ($thread['lastpost'] > $threadview) {
$show['firstnew'] = true;
$show['icon'] = false;
}
}
exec_switch_bg();
eval("\$threadbits .= \"".fetch_template('forumhome_latestthreadbit')."\";");
}
if ($threads) {
$show['latestthreads'] = true;
}
// memory saving
unset($thread, $threads);
$DB_site->free_result($getthreads);
// [END HACK='Latest Threads On Forum Home' AUTHOR='NTLDR' VERSION='1.0.0' CHANGEID= 2 ]
From there I went to my admin panel and did a search in templates for the following code:
class="smallfont">$upcomingevents</div></td>
</tr>
</tbody>
</if>
There was a close table tag there that I had to push down a line so that I could add this:
<!-- [START HACK='Latest Threads On Forum Home' AUTHOR='NTLDR' VERSION='1.0.0' CHANGEID= 1 ] -->
<!-- latest threads -->
<if condition="$show['latestthreads']">
<tbody>
<tr>
<td class="thead" colspan="2">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_latestthreads')"><img id="collapseimg_forumhome_latestthreads" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_latestthreads].gif" alt="" border="0" /></a>
$vbphrase[latest_threads]
</td>
</tr>
</tbody>
<tbody id="collapseobj_forumhome_latestthreads" style="$vbcollapse[collapseobj_forumhome_latestthreads]">
<tr>
<td class="alt2"> </td>
<td class="alt1"><div class="smallfont">$threadbits</div></td>
</tr>
</tbody>
</if>
<!-- /latest threads -->
<!-- [END HACK='Latest Threads On Forum Home' AUTHOR='NTLDR' VERSION='1.0.0' CHANGEID= 1 ] -->
now I moved on to creating a new template... this took me a second or two to figure out but I got her done...
I created: forumhome_latestthreadbit
Then added the code:
<div class="smallfont">
<if condition="$show['firstnew']">
<a href="showthread.php?$session[sessionurl]threadid=$thread[threadid]&goto=newpost"><img src="$stylevar[imgdir_button]/firstnew.gif" alt="$vbphrase[go_to_first_new_post]" border="0" /></a>
</if>
<if condition="$show['icon'] && !$show['firstnew']">
<img src="$vboptions[bburl]/$thread[threadiconpath]" border="0" alt="$thread[threadicontitle]" title="$thread[threadicontitle]" style="vertical-align: text-middle" />
</if>
<a href="showthread.php?$session[sessionurl]threadid=$thread[threadid]" title="$thread[preview]"><strong>$thread[title]</strong></a>
<em>$vbphrase[last_post]:</em> $thread[date] <if condition="$vboptions['yestoday'] != 2"><span class="time">$thread[time]</span></if> <phrase 1="member.php?$session[sessionurl]find=lastposter&threadid=$thread[threadid]" 2="$thread[lastposter]">$vbphrase[by_x]</phrase>
? $vbphrase[replies]: $thread[replycount]
? $vbphrase[views]: $thread[views]
</div>
Last I created the phrase... that was the easiest part.
I then uploaded my index.php and recieved the error.
Now on line 460 in DW this is what I see:
$thread['preview'] = htmlspecialchars_uni(fetch_trimmed_title(strip_bbc ode(fetch_censored_text($thread['preview']), false, true), $vboptions['threadpreview']));
I don't know if this is the correct line you are looking for. But I'm quite the n00b at this.
Please help.
Marco van Herwaarden
03-30-2005, 05:01 AM
$thread['preview'] = htmlspecialchars_uni(fetch_trimmed_title(strip_bbc ode(fetch_censored_text($threa d['preview']), false, true), $vboptions['threadpreview']));
There is a space in '$threa d['preview']), '.
PS DreamWeaver with standard settings is not the best editor for your php-files.
Sun Boy
03-30-2005, 11:52 AM
i would like to use hack like this but on non-vb page witout vb templates
some thing like the one on www.hotscripts.com
but i dont know how to do it exactly
so could you explan to me how to do it ?
ProperMethodz
03-30-2005, 05:03 PM
$thread['preview'] = htmlspecialchars_uni(fetch_trimmed_title(strip_bbc ode(fetch_censored_text($threa d['preview']), false, true), $vboptions['threadpreview']));
There is a space in '$threa d['preview']), '.
PS DreamWeaver with standard settings is not the best editor for your php-files.
What do you suggest? When I open it in notepad it's all hosed.
Marco van Herwaarden
03-30-2005, 05:38 PM
There are many good editors around, some payed, some free.
Personally i use UltraEdit, since i know it will work correct on every unix and windows file, and it has some nice code highlighting features (and a lot more).
ProperMethodz
03-30-2005, 07:44 PM
Thanks... and thanks for your help.
It works now...
www.7hmgaming.com
ProperMethodz
03-30-2005, 07:46 PM
i would like to use hack like this but on non-vb page witout vb templates
some thing like the one on www.hotscripts.com
but i dont know how to do it exactly
so could you explan to me how to do it ?
I would also like to do this... Is there instructions somewhere on how this is done? Also, I would like to be able to list all latest posts within a given time rather then within a number. I would like this to display through an I frame which I have on my home page.
osariase
04-07-2005, 09:56 PM
HI NTDL
I installed your hack its is beautiful. one thing I found is that you asked to do some changes in index.php, I couldn't find the line of code u mentioned so I checked forum.php and it was there so i did the changes there. But I was expecting to be in my homepage which is the index (advanced cmps) like the other modules. I want it in the home page instead of below the forums.
My question is how do iI put it there on my index just like rest such as welcome block etc.
Could you please tell me how i can do that thanks
testes
04-08-2005, 01:26 AM
hi there.
i want to display 2 "lastthreads" with vbindex.
task: both latestthreads are just displaying threads of a single forum, BUT both are displaying different content. let's say "lastthreads1" displays content from forumID=21 and "lastthreads2" displays content from forumID=22
any suggestions how to work that out in the script? it has to be possible...
TheBurner
05-30-2005, 04:19 AM
Is it possible to change the position of the latest treads?
I want it under the navbar and above the forums....
What are the things that must be changed?
I think it's pretty simple to change it in FORUMHOME butt I can't do it.
I messed up so I changed it back.
Kan anyone help me out?
TheBurner
05-30-2005, 04:33 AM
I did it right this time :D
Sorry for the post....
ayhanaydogdu
06-01-2005, 05:12 PM
Hello firends. Does this work for version 3.0.7? i did all steps but there is no change in index.php. please help :( .
Thank you.
TheBurner
06-01-2005, 05:45 PM
Hello firends. Does this work for version 3.0.7? i did all steps but there is no change in index.php. please help :( .
Thank you.
I have also 3.07 and it works fine.
I also placed the lastest threads at the top of the page. Verry usefull.
ayhanaydogdu
06-01-2005, 05:48 PM
TheBurner, friend. can i take your a few minute i will ask you some question. Can we talk on msn please :(
my msn = ayhanaydogdu@hotmail.com
Sleepyk
06-16-2005, 11:21 PM
this work on 3.0.7?
RichieBoy67
06-17-2005, 08:12 PM
Yes, perfectly..
ProperMethodz
06-20-2005, 06:54 PM
lol... here's a funny one to ask. If you go to my site you'll see that I have two different versions of this hack in stalled.
www.7hmgaming.com
on style 7hm it is aligned "Left"
and on Plasma_x it's justified and in columns.
How the hell did I do this? :) I can't remember which adjustment I made for this to happen...
ProperMethodz
06-20-2005, 07:11 PM
OK... here is what I did.
in forumhome_latestthreadbit
Replace:
<div class="smallfont">
<if condition="$show['firstnew']">
<a href="showthread.php?$session[sessionurl]threadid=$thread[threadid]&goto=newpost"><img src="$stylevar[imgdir_button]/firstnew.gif" alt="$vbphrase[go_to_first_new_post]" border="0" /></a>
</if>
<if condition="$show['icon'] && !$show['firstnew']">
<img src="$vboptions[bburl]/$thread[threadiconpath]" border="0" alt="$thread[threadicontitle]" title="$thread[threadicontitle]" style="vertical-align: text-middle" />
</if>
<a href="showthread.php?$session[sessionurl]threadid=$thread[threadid]" title="$thread[preview]"><strong>$thread[title]</strong></a>
<em>$vbphrase[last_post]:</em> $thread[date] <if condition="$vboptions['yestoday'] != 2"><span class="time">$thread[time]</span></if> <phrase 1="member.php?$session[sessionurl]find=lastposter&threadid=$thread[threadid]" 2="$thread[lastposter]">$vbphrase[by_x]</phrase>
? $vbphrase[replies]: $thread[replycount]
? $vbphrase[views]: $thread[views]
</div>
With:
<div class="smallfont">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td width="30%"><div class="smallfont"><a href="showthread.php?$session[sessionurl]threadid=$thread[threadid]" title="$thread[preview]"><strong>$thread[title]</strong></a></div></td>
<td width="30%"><div class="smallfont"><em>$vbphrase[last_post]:</em> $thread[date] <if condition="$vboptions['yestoday'] != 2"><span class="time">$thread[time]</span></if></div></td>
<td width="16%"><div class="smallfont"><phrase 1="member.php?$session[sessionurl]find=lastposter&threadid=$thread[threadid]" 2="$thread[lastposter]">$vbphrase[by_x]</phrase></div></td>
<td width="12%"><div class="smallfont">$vbphrase[replies]: $thread[replycount]</div></td>
<td width="12%"><div class="smallfont">$vbphrase[views]: $thread[views]</div></td>
</tr>
</table>
</div>
Lea Verou
07-24-2005, 08:44 AM
Hi all!
How can I set it so that it doesn't cut off the titles of the threads at about 20 chars but at 40?
I took a quick look in all the posts in this thread and I didn't see anyone asking the same. Currently I'm looking at the code but I don't think I'll find it as I don't know PHP but only the basics.
Thanks in advance, it will be just perfect with that change!
:)
//edit: just finished checking the code that I added/modified and couldn't find anything... :(
wolfgrrl
07-26-2005, 12:20 AM
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/www/XXXXXXXX/forums/index.php on line 64
Not working here and double checked everything......anyone can help?
Lea Verou
07-29-2005, 08:11 AM
Any idea for my problem? Please, it can't be that difficult!
InsaneContender
08-11-2005, 06:40 AM
How would I go about integrating this into a sidebar that is shown on all pages?
Sleepyk
08-11-2005, 08:50 PM
nice hack very easy
Lea Verou
08-12-2005, 12:10 PM
Help!!!!!! I modified the code so that it displays locked thread but now it displays the threads form the hidden forums as well!!!!!!!!!
Please help, I am in despair!!!!
somasimple
08-13-2005, 06:44 AM
Hi All,
Is it possible to move the latest threads mod from bottom to a place just over the forum "head" (between navbar and titles)?
works on vBulletin Version 3.0.7
clicks installed
PS: how hard would this be to have anchored under the nav bar?
if possible, some direction please.. Thank you, great hack
Fallback
08-27-2005, 04:26 PM
Is there a way to modify this to show threads YOU have recently viewed?
Akakios
08-29-2005, 08:11 AM
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/www/XXXXXXXX/forums/index.php on line 64
Not working here and double checked everything......anyone can help?
INDEX.PHP
'forumhome_subforumseparator_post' =>
'forumhome_subforumseparator_post' ,
RichieBoy67
09-03-2005, 06:22 PM
I came up with an idea last night for an addon to this latest threads hack.
What I would like to do is have the table split into two tables. One will have the latest threads from the forums and the other table could have the latest threads from say rss feeds?? I have tons of feeds on my site and I would love to seperate them from regular posts. Right now I have just excluded all the rss feed forums from being listed in the latest thread area...
anyhow, what do you think??? How hard would this be????
Thanks
Rich
dostborsa
09-05-2005, 12:47 PM
Hello !
I have completed all steps until here .
But I don't understand following step (last step)
can you please explain me what must I do then.
Create a new phrase called latest_threads in the GLOBAL group with the following content:
Latest Threads
xtreme-mobile
09-05-2005, 06:23 PM
great little hack, is there any way of stretching it slioghty? what i mean is it doesnt show the full thread header and there is loads of wasted space on right, if i could spread it out to the right a bit more it would be good
can this be done?
regards
dean
clicks install
dostborsa
09-05-2005, 07:19 PM
Hi,
How Can I put an icon like gif to reach the latest thread or is there any way to read the latest thread in a forum page in the middle of the page? Thx.
carwash
10-13-2005, 01:21 AM
Is there something similar to this great hack for vbulletin 3.5? My members and I have come to rely on it.
Just one more correction. If you guys use vbadvanced (http://www.vbadvanced.com), you may want to modify the template to have the icons display correctly.
Go in your forumhome_latestthreadbit template that was created with the hack (the vbulletin.org one, latest threads) and replace:
<img src="$vboptions[bburl]/$thread[threadiconpath]" border="0" alt="$thread[threadicontitle]" title="$thread[threadicontitle]" style="vertical-align: text-middle" />
with:
<img src="$thread[threadiconpath]" border="0" alt="$thread[threadicontitle]" title="$thread[threadicontitle]" style="vertical-align: text-middle" />
See the $vboptions[bburl]/ that was erased ? That's it.
+ enter the full path of your default icon in the admin panel:
vbulletin options >> Thread display options
Thank you, this DID resolve my missing icon issues as well. Mind you i didn thave to do te "enter the full path......"
Dark Riku
11-12-2005, 03:06 AM
How can i get this to display in the header?
Death Star
11-12-2005, 07:28 AM
Is there something similar to this great hack for vbulletin 3.5? My members and I have come to rely on it.
I have been looking around for this for 3.5 with no avail... :disappointed:
Could someone make an update for the 3.5 users?
Lea Verou
11-12-2005, 07:37 AM
guys you underestimate vbulletin.com :p
http://www.vbulletin.com/forum/showthread.php?t=158887 ;)
Boofo
11-12-2005, 07:47 AM
amykhar also did one called hot topics for 3.5. ;)
Death Star
11-12-2005, 08:03 AM
guys you underestimate vbulletin.com :p
http://www.vbulletin.com/forum/showthread.php?t=158887 ;)
Tried it :disappointed:
Lea Verou
11-12-2005, 08:13 AM
Tried it :disappointed:
What was the problem?
Zidane007nl
11-13-2005, 09:06 PM
Installed the hack, nice work.
I inserted it into my welcome panel (only visible for users), with marquee tags, so I won't take up much space. :)
MRGTB
02-17-2006, 11:24 AM
I know this is an old hack, but does anybody know how you can add the forum board in the stats where the latest threads are listed. So it also shows what forum the posts the thread came from at the end of the link stats
MRGTB
02-26-2006, 05:28 PM
Help!!!!!! I modified the code so that it displays locked thread but now it displays the threads form the hidden forums as well!!!!!!!!!
Please help, I am in despair!!!!
How did you get it to display locked threads Michelle.
Also, remember it will show threads to you in hidden boards while you logged in as admin and have access to view the hidden boards. But if you log-out then login as a member who does not have access to view the hidden boards. You will not see the threads listed from that board based on permission.
But please let me know what you did to get it to show locked threads.
fatwillie
02-27-2006, 01:18 AM
Will this hack work on a non VB page?
MRGTB
03-05-2006, 09:47 PM
BUMP
Does does anybody know how to make this hack so it will display "Locked Threads"?
And if possible, also show the "Forum Board" threads are taken from
norma-aguilera
09-10-2006, 03:49 PM
Hi,
I read all of the threads and this forum, but I don't think anyone is having the same problem that i am having.
I did all of the steps in the installation, checked twice and I get this error:
Warning: Invalid argument supplied for foreach() in /index.php on line 493
Fatal error: Call to a member function on a non-object in /home/mxfimrk/public_html/Forum/index.php on line 509
I looked at the code in index.php in line 493 and this is what is trying to do:
************************************************** ********
// [START HACK='Latest Threads On Forum Home' AUTHOR='NTLDR' VERSION='1.0.0' CHANGEID= 2 ]
// #################### PROCESS LATEST THREADS #######################
// fetch the permissions for each forum
$forumperms = array();
foreach($forumcache AS $forum) {
$forumperms["$forum[forumid]"] = fetch_permissions($forum['forumid']);
// ## HIDE FORUMS WITHOUT THE CANVIEW OR CANVIEWOTHERS PERMISSION ##
if (!($forumperms["$forum[forumid]"] & CANVIEW) || !($forumperms["$forum[forumid]"] & CANVIEWOTHERS)) {
$limitfids .= ','.$forum['forumid'];
}
}
************************************************** ********
Also, I use cpanel to modify the files and I whenever I try to save the files I get the "The page cannot be displayed" error. So I tried chaning the file in my vi editor and coping and pasting to the cpanel editor and I still get that error. The second time I saved it is OK.
Had anybody experience this error or can help?
Thanks!
Norma Aguilera
norma-aguilera
09-10-2006, 04:53 PM
I am still having the problem above. It was not a parsing error ( I had just updated the file with my original index.php).
I really want this hack for my web site, so I will really appreciate if someone can help me with any information.
I did ALL of the steps specified on the hack, but I am still having this error:
************************************************** **********
Warning: Invalid argument supplied for foreach() in /index.php on line 492
Fatal error: Call to a member function on a non-object in /home/mxfimrk/public_html/Forum/index.php on line 509
I highlighted these two lines below.
Thanks!
************************************************** **********
// get total members and newest member from template
$numbermembers = vb_number_format($vbulletin->userstats['numbermembers']);
$newusername = $vbulletin->userstats['newusername'];
$newuserid = $vbulletin->userstats['newuserid'];
$activemembers = vb_number_format($vbulletin->userstats['activemembers']);
$show['activemembers'] = ($vbulletin->options['activememberdays'] > 0 AND ($vbulletin->options['activememberoptions'] & 2)) ? true : false;
// [START HACK='Latest Threads On Forum Home' AUTHOR='NTLDR' VERSION='1.0.0' CHANGEID= 2 ]
// #################### PROCESS LATEST THREADS #######################
// fetch the permissions for each forum
$forumperms = array();
foreach($forumcache AS $forum) {
$forumperms["$forum[forumid]"] = fetch_permissions($forum['forumid']);
// ## HIDE FORUMS WITHOUT THE CANVIEW OR CANVIEWOTHERS PERMISSION ##
if (!($forumperms["$forum[forumid]"] & CANVIEW) || !($forumperms["$forum[forumid]"] & CANVIEWOTHERS)) {
$limitfids .= ','.$forum['forumid'];
}
}
unset($forum);
if ($vboptions['threadpreview'] > 0) {
$previewfield = ', post.pagetext AS preview';
$previewjoin = 'LEFT JOIN '.TABLE_PREFIX.'post AS post ON(post.postid = thread.firstpostid)';
}
$getthreads = $DB_site->query("
## GET LATEST THREADS ##
SELECT thread.*,thread.iconid AS threadiconid $previewfield
FROM ".TABLE_PREFIX."thread AS thread
LEFT JOIN ".TABLE_PREFIX."deletionlog AS deletionlog ON(thread.threadid = deletionlog.primaryid AND type = 'thread')
$previewjoin
WHERE open = '1'
AND forumid NOT IN (0$limitfids)
AND thread.visible = '1'
AND deletionlog.primaryid IS NULL
ORDER BY lastpost
DESC LIMIT 5");
while($thread = $DB_site->fetch_array($getthreads)) {
$threads = true;
$thread['title'] = fetch_censored_text(fetch_trimmed_title(unhtmlspec ialchars($thread['title']), 22));
$thread['date'] = vbdate($vboptions['dateformat'], $thread['lastpost'], 1);
$thread['time'] = vbdate($vboptions['timeformat'], $thread['lastpost']);
$thread['preview'] = preg_replace('#\[quote(=("|"|\'|).*\\2)?\](.*)\[/quote\]#siU', '', $thread['preview']);
$thread['preview'] = htmlspecialchars_uni(fetch_trimmed_title(strip_bbc ode(fetch_censored_text($thread['preview']), false, true), $vboptions['threadpreview']));
$thread['replycount'] = vb_number_format($thread['replycount']);
$thread['views'] = vb_number_format($thread['views']);
// thread icon
$show['icon'] = false;
$icon = fetch_iconinfo($thread['iconid']);
if (is_array($icon)) {
$show['icon'] = true;
$thread['threadiconpath'] = $icon['iconpath'];
$thread['threadicontitle'] = $icon['title'];
}
// show goto new post
$show['firstnew'] = false;
$bbforumview = fetch_bbarray_cookie('forum_view', $thread['forumid']);
if ($bbforumview > $bbuserinfo['lastvisit']) {
$lastread = $bbforumview;
} else {
$lastread = $bbuserinfo['lastvisit'];
}
if ($thread['lastpost'] > $lastread) {
$threadview = fetch_bbarray_cookie('thread_lastview', $thread['threadid']);
if ($thread['lastpost'] > $threadview) {
$show['firstnew'] = true;
$show['icon'] = false;
}
}
exec_switch_bg();
eval("\$threadbits .= \"".fetch_template('forumhome_latestthreadbit')."\";");
}
if ($threads) {
$show['latestthreads'] = true;
}
// memory saving
unset($thread, $threads);
$DB_site->free_result($getthreads);
// [END HACK='Latest Threads On Forum Home' AUTHOR='NTLDR' VERSION='1.0.0' CHANGEID= 2 ]
// ### ALL DONE! SPIT OUT THE HTML AND LET'S GET OUTTA HERE... ###
($hook = vBulletinHook::fetch_hook('forumhome_complete')) ? eval($hook) : false;
trickfly
01-06-2007, 05:57 PM
Hi there,
I've used your script and it is working fine (thanks!)
but how do I make it look like the one on:
http://www.cosforums.com/
Please PM me back thanks.
James
fwmike
04-03-2008, 09:04 PM
Hi, this script is working great - but I would like it to display the forum name also? Anyone have an idea how to do that?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.