View Full Version : [New Posts | New Thread | Search] on Index page
ForumDog
07-25-2006, 10:00 PM
This adds forum section-specific New Posts, New Thread and Search links to the index page.
New Posts will only appear when there are new posts in that section and will only list new posts from the section.
New Thread will start a new thread in that section.
Search will start a search for only that section.
A search did bring up something similar but it was neither as complete nor as aesthetically pleasing (to me). I apologise if this is duplicated.
Open your forumhome_forumbit_level1/2_post template.
FIND:
<if condition="$show['forumdescription']">
<div class="smallfont">$forum[description]</div>
</if>
AFTER, ADD:
<if condition="$forum[statusicon]=='new' OR $forum[statusicon]=='old'">
<div class="smallfont">
<if condition="$forum[statusicon]=='new'"><a href="search.php?$session[sessionurl]do=getnew&include=$forum[forumid]">$vbphrase[new_posts_nav]</a> | </if>
<a href="newthread.php?$session[sessionurl]do=newthread&f=$forum[forumid]" rel="nofollow">New Thread</a>
<if condition="$show['searchbuttons']">| <a href="search.php?$session[sessionurl]f=$forum[forumid]" rel="nofollow">$vbphrase[search]</a></if>
</div>
</if>
Optional extras:
- Subscription code for each feed type, all conditionals so they'll only appear if you've turned that type on.
- Unsubscribe moved to the linkfest since it seems to fit better there. Be sure to delete the very similar code which appears immediately below where this code is inserted, everything between <if condition="$show['forumsubscription']"> and </if>.
<if condition="$forum[statusicon]=='new' OR $forum[statusicon]=='old'">
<div class="smallfont">
<if condition="$forum[statusicon]=='new'"><a href="search.php?$session[sessionurl]do=getnew&include=$forum[forumid]">$vbphrase[new_posts_nav]</a> | </if>
<a href="newthread.php?$session[sessionurl]do=newthread&f=$forum[forumid]" rel="nofollow">New Thread</a>
<if condition="$show['searchbuttons']">| <a href="search.php?$session[sessionurl]f=$forum[forumid]" rel="nofollow">$vbphrase[search]</a></if>
<if condition="$vbulletin->options['externalrss']">| <a href="external.php?type=rss2&forumids=$forum[forumid]">RSS Feed</a></if>
<if condition="$vbulletin->options['externalxml']">| <a href="external.php?type=xml&forumids=$forum[forumid]">XML Feed</a></if>
<if condition="$vbulletin->options['externaljs']">| <a href="external.php?type=js&forumids=$forum[forumid]">JS Feed</a></if>
<if condition="$show['forumsubscription']">| <a href="subscription.php?$session[sessionurl]do=removesubscription&f=$forum[forumid]">$vbphrase[unsubscribe_from_this_forum]</a></if>
</if>
Update:
- The conditional should now be correct so the links will only appear for open forums. It's up to you if you want to change that.
- The search link is now wrapped in a conditional so it doesn't appear when it's not wanted, most likely for Guests, New Thread is also now controlled as far as is possible by the statusicon conditional. Permission to start a new thread is only checked after clicking the link as far as I can tell, so it can't be done perfectly.
- Not a big deal, but added rel="nofollow" in a couple of places where the links aren't any use to search engines.
Known Issues:
- If there is no permission to start a new thread or search and there are no new posts to view but the unsubscribe link or a feed link appears then the line will begin with a |. It could be solved with a loooooooot of conditionals but it's not worth it. Change the formatting (use of |) if it bothers you.
Shazz
07-26-2006, 04:23 PM
Very Creative , I will be using this :)
________
volcano vaporizer reviews (http://vaporizer.org/reviews/volcano)
A_N_K_A_R_A
07-30-2006, 09:05 AM
very nice thanks
Snake
07-30-2006, 12:13 PM
Lovely it could be much better if they were using images. ;)
h_kakashi
08-04-2006, 12:29 AM
Installed :) Nice touch
tpzone
08-07-2006, 05:59 AM
piece of cake.. thank you for the mod, very nice!
TygerTyger
08-09-2006, 06:57 AM
Lovely it could be much better if they were using images. ;)
Personal taste. :p I like quick and clean myself.
netwiz
08-16-2006, 03:30 PM
Seems to be nice. But in my installation i couldnot locate the forumhome_forumbit_level1/2_post template :-(
pls do update your steps keeping newbies also in mind:-(
ForumDog
08-16-2006, 03:39 PM
AdminCP > Styles & Templates > Search in Templates > Search for forumbit
In the results, forumhome_forumbit_level1 and 2 will appear, you want the post versions of each and not the nopost versions.
Level 1 is the forum sections that show up on the index page, Level 2 is for subforums that show up on forum listing pages.
:)
bada_bing
08-16-2006, 07:43 PM
I have installed this but had to remove because its not displaying correctly when using subforums... If my subforum structure is setup like this
-Forum Name
--Forum (Locked)
---Child Forum1
---Child Forum2
---Child Forum3
Then locked forum show the New Thread- Search and when you click you get dont have access...
ForumDog
08-17-2006, 08:22 AM
Try replacing it with this:
<if condition="!$forum[statusicon] == 'new_lock' OR !$forum[statusicon] == 'old_lock' OR !$forum[statusicon] == 'link'">
<div class="smallfont">
<if condition="$forum[statusicon]=='new'">
<a href="search.php?$session[sessionurl]do=getnew&include=$forum[forumid]">$vbphrase[new_posts_nav]</a> |
</if>
<a href="newthread.php?$session[sessionurl]do=newthread&f=$forum[forumid]">New Thread</a> |
<a href="search.php?$session[sessionurl]f=$forum[forumid]">$vbphrase[search]</a>
</div>
</if>
That should (untested) mean that if the forum isn't locked or a link, display the links. Search is included in that, so if you want to allow people to search locked forums you'll have to move the </if> tag up so the Search link is outside it.
bada_bing
08-17-2006, 12:02 PM
Try replacing it with this:
<if condition="!$forum[statusicon] == 'new_lock' OR !$forum[statusicon] == 'old_lock' OR !$forum[statusicon] == 'link'">
<div class="smallfont">
<if condition="$forum[statusicon]=='new'">
<a href="search.php?$session[sessionurl]do=getnew&include=$forum[forumid]">$vbphrase[new_posts_nav]</a> |
</if>
<a href="newthread.php?$session[sessionurl]do=newthread&f=$forum[forumid]">New Thread</a> |
<a href="search.php?$session[sessionurl]f=$forum[forumid]">$vbphrase[search]</a>
</div>
</if>
That should (untested) mean that if the forum isn't locked or a link, display the links. Search is included in that, so if you want to allow people to search locked forums you'll have to move the </if> tag up so the Search link is outside it.
I will try this... Do you know how many queries this gernerates on every page load?
ForumDog
08-17-2006, 12:04 PM
None. Not even a fairly large amount of conditionals will slow things down.
Brandon Sheley
08-22-2006, 04:14 AM
umm,,
http://forum.vbulletinsetup.com/f7/32-new-thread-search-subscribe-rss.html
I got this code from Keith Cohen months ago ;)
with his permission
[New Thread] - [Search] - [Subscribe] - [RSS]
if you like what we've added at vBulletin Setup and want it on your site here is your code..
Here's the code I use in forumbit level 1 and 2:
<if condition="$forum[link] == ''">
<span class="tinyfont">
- [<a href="/forums/newthread.php?do=newthread&f=$forum[forumid]" title="Post a new thread in $forum[title]">New Thread</a>] - [<a href="/forums/search.php?forumid=$forum[forumid]" title="Search $forum[title]">Search</a>] - [<a href="/forums/subscription.php?do=addsubscription&f=$forum[forumid]" title="Subscribe to $forum[title]">Subscribe</a>] - [<a href="/forums/external.php?type=rss2&forumids=$forum[forumid]" target="_blank" title="RSS feed for $forum[title]">RSS</a>]
</span>
</if>
this assumes your vb is in a forums/ folder..
and like on our site, the forum home view don't allow new threads, so it was all useless and we just needed it on the forumdisplay page.. this is how to achieve that..
<if condition="THIS_SCRIPT == 'index'">
main forums page code
</if>
<if condition="THIS_SCRIPT == 'forumdisplay'">
forumsdisplay page code
</if>
and add this to your Additional CSS Definitions to make them small like on here
.tinyfont { font-size: 9px;}
btw, i just changed style, so i haven't added this code back.. but i did post this last month on the link above, and had it on an old site b4 that ;)
Avalon111
08-22-2006, 05:11 AM
This is great!!!
i have just changed it a bit (hope you dont mind :) )
<!-- [View New Posts | Start New Thread | Search] on Index page by ForumDog -->
<div class="smallfont">
<if condition="$forum[statusicon]=='new'">
<a href="search.php?$session[sessionurl]do=getnew&include=$forum[forumid]">View New Posts</a> |
</if>
<a href="newthread.php?$session[sessionurl]do=newthread&f=$forum[forumid]">Start New Thread</a> |
<a href="search.php?$session[sessionurl]f=$forum[forumid]">Search Forum</a>
</div>
<!-- [View New Posts | Start New Thread | Search] on Index page by ForumDog -->
Avalon111
08-22-2006, 05:26 AM
Try replacing it with this:
<if condition="!$forum[statusicon] == 'new_lock' OR !$forum[statusicon] == 'old_lock' OR !$forum[statusicon] == 'link'">
<div class="smallfont">
<if condition="$forum[statusicon]=='new'">
<a href="search.php?$session[sessionurl]do=getnew&include=$forum[forumid]">$vbphrase[new_posts_nav]</a> |
</if>
<a href="newthread.php?$session[sessionurl]do=newthread&f=$forum[forumid]">New Thread</a> |
<a href="search.php?$session[sessionurl]f=$forum[forumid]">$vbphrase[search]</a>
</div>
</if>
That should (untested) mean that if the forum isn't locked or a link, display the links. Search is included in that, so if you want to allow people to search locked forums you'll have to move the </if> tag up so the Search link is outside it.
tried this code, nothing showed up. no "New Posts, Thread or search"
Brandon Sheley
08-22-2006, 04:13 PM
you can use the code i posted ;)
it works just fine..
if you still can't get it, give me a PM and I'll help ya out :)
Avalon111
08-23-2006, 04:10 AM
you can use the code i posted ;)
it works just fine..
if you still can't get it, give me a PM and I'll help ya out :)
thanks for the offer :)
the code from the first post works like a charm it was just this 2nd posted code that has been posted that seems not to work.
the one that should not display [New Posts | New Thread | Search] for link forums ect.
ForumDog
08-23-2006, 11:50 AM
Okee dokee, that'll teach me to post untested code! New version which is thoroughly tested and seems to work, if someone else gives it a whirl and it turns out to be the correct can they let me know so I can properly update.
Update:
- The conditional should now be correct so the links will only appear for open forums. It's up to you if you want to change that.
- The search link is now wrapped in a conditional so it doesn't appear when it's not wanted, most likely for Guests, New Thread is also now controlled as far as is possible by the statusicon conditional. Permission to start a new thread is only checked after clicking the link as far as I can tell, so it can't be done perfectly.
- Not a big deal, but added rel="nofollow" in a couple of places where the links aren't any use to search engines.
<if condition="$forum[statusicon]=='new' OR $forum[statusicon]=='old'">
<div class="smallfont">
<if condition="$forum[statusicon]=='new'"><a href="search.php?$session[sessionurl]do=getnew&include=f=$forum[forumid]">$vbphrase[new_posts_nav]</a> | </if>
<a href="newthread.php?$session[sessionurl]do=newthread&f=$forum[forumid]" rel="nofollow">New Thread</a>
<if condition="$show['searchbuttons']">| <a href="search.php?$session[sessionurl]f=$forum[forumid]" rel="nofollow">$vbphrase[search]</a></if>
</div>
</if>
Update: Optional extras:
- Subscription code for each feed type, all conditionals so they'll only appear if you've turned that type on.
- Unsubscribe moved to the linkfest since it seems to fit better there. Be sure to delete the very similar code which appears immediately below where this code is inserted, everything between <if condition="$show['forumsubscription']"> and </if>.
<if condition="$forum[statusicon]=='new' OR $forum[statusicon]=='old'">
<div class="smallfont">
<if condition="$forum[statusicon]=='new'"><a href="search.php?$session[sessionurl]do=getnew&include=f=$forum[forumid]">$vbphrase[new_posts_nav]</a> | </if>
<a href="newthread.php?$session[sessionurl]do=newthread&f=$forum[forumid]" rel="nofollow">New Thread</a>
<if condition="$show['searchbuttons']">| <a href="search.php?$session[sessionurl]f=$forum[forumid]" rel="nofollow">$vbphrase[search]</a></if>
<if condition="$vbulletin->options['externalrss']">| <a href="external.php?type=rss2&forumids=$forum[forumid]">RSS Feed</a></if>
<if condition="$vbulletin->options['externalxml']">| <a href="external.php?type=xml&forumids=$forum[forumid]">XML Feed</a></if>
<if condition="$vbulletin->options['externaljs']">| <a href="external.php?type=js&forumids=$forum[forumid]">JS Feed</a></if>
<if condition="$show['forumsubscription']">| <a href="subscription.php?$session[sessionurl]do=removesubscription&f=$forum[forumid]">$vbphrase[unsubscribe_from_this_forum]</a></if>
</if>
Known Issues:
- If there is no permission to start a new thread or search and there are no new posts to view but the unsubscribe link or a feed link appears then the line will begin with a |. It could be solved with a loooooooot of conditionals but it's not worth it. Change the formatting (use of |) if it bothers you.
umm,,
http://forum.vbulletinsetup.com/f7/32-new-thread-search-subscribe-rss.html
<if condition="$forum[link] == ''">
<span class="tinyfont">
- [<a href="/forums/newthread.php?do=newthread&f=$forum[forumid]" title="Post a new thread in $forum[title]">New Thread</a>] - [<a href="/forums/search.php?forumid=$forum[forumid]" title="Search $forum[title]">Search</a>] - [<a href="/forums/subscription.php?do=addsubscription&f=$forum[forumid]" title="Subscribe to $forum[title]">Subscribe</a>] - [<a href="/forums/external.php?type=rss2&forumids=$forum[forumid]" target="_blank" title="RSS feed for $forum[title]">RSS</a>]
</span>
</if>
...
<if condition="THIS_SCRIPT == 'index'">
main forums page code
</if>
<if condition="THIS_SCRIPT == 'forumdisplay'">
forumsdisplay page code
</if>
- My code uses session URLs as you are supposed to do, that code doesn't.
- Mine uses conditionals so is automatically adaptable.
- Mine is phrased (admittedly that's barely possible, but I did what I could :p)
- I know what the THIS_SCRIPT code does, I don't know what it's there for or even where it goes. But I don't think it should be used, it will prevent the links from showing up anywhere else, in the Subscribed Threads forumbit for instance. Come to that I'm not sure that $forum[link] is the correct conditional to use either...
- Mine will display as intended using the existing CSS.
So, as I guessed it had been done before but enough reason to use this one instead. :D
Avalon111
08-23-2006, 01:48 PM
great!
i will give it a shot tomorrow :)
Avalon111
08-23-2006, 07:02 PM
<if condition="$forum[statusicon]=='new' OR $forum[statusicon]=='old'">
<div class="smallfont">
<if condition="$forum[statusicon]=='new'"><a href="search.php?$session[sessionurl]do=getnew&include=f=$forum[forumid]">$vbphrase[new_posts_nav]</a> | </if>
<a href="newthread.php?$session[sessionurl]do=newthread&f=$forum[forumid]" rel="nofollow">$vbphrase[newthread]</a>
<if condition="$show['searchbuttons']">| <a href="search.php?$session[sessionurl]f=$forum[forumid]" rel="nofollow">$vbphrase[search]</a></if>
<if condition="$vbulletin->options['externalrss']">| <a href="external.php?type=rss2&forumids=$forum[forumid]">RSS Feed</a></if>
<if condition="$vbulletin->options['externalxml']">| <a href="external.php?type=xml&forumids=$forum[forumid]">XML Feed</a></if>
<if condition="$vbulletin->options['externaljs']">| <a href="external.php?type=js&forumids=$forum[forumid]">JS Feed</a></if>
<if condition="$show['forumsubscription']">| <a href="subscription.php?$session[sessionurl]do=removesubscription&f=$forum[forumid]">$vbphrase[unsubscribe_from_this_forum]</a></if>
</if>
Known Issues:
- If there is no permission to start a new thread or search and there are no new posts to view but the unsubscribe link or a feed link appears then the line will begin with a |.
i have just replaced the original code with the new one you posted.
the original code showed the "New Thread", the new one doesnt.
if i change this line in the new code from
<a href="newthread.php?$session[sessionurl]do=newthread&f=$forum[forumid]" rel="nofollow">$vbphrase[newthread]</a>
to
<a href="newthread.php?$session[sessionurl]do=newthread&f=$forum[forumid]" rel="nofollow">Start New Thread</a>
it works again.
$vbphrase[newthread] wrong??
ForumDog
08-23-2006, 07:15 PM
I can't reproduce that issue. Works fine either way for me.
Avalon111
08-23-2006, 07:25 PM
I can't reproduce that issue. Works fine either way for me.
weird. trying it agin tomorrow. then i post a screenshot here.
thanks for your efforts.
Brandon Sheley
08-24-2006, 04:23 AM
- My code uses session URLs as you are supposed to do, that code doesn't.
- Mine uses conditionals so is automatically adaptable.
- Mine is phrased (admittedly that's barely possible, but I did what I could :p)
- I know what the THIS_SCRIPT code does, I don't know what it's there for or even where it goes. But I don't think it should be used, it will prevent the links from showing up anywhere else, in the Subscribed Threads forumbit for instance. Come to that I'm not sure that $forum[link] is the correct conditional to use either...
- Mine will display as intended using the existing CSS.
So, as I guessed it had been done before but enough reason to use this one instead. :D
OK, I just thought it was coincidence that it looks just like what Keith had sent me :P
I hadn't looked through the code, I just know it works..
BTW, what do u think about the RSS link thats in the code I posted ;) I know a lot of ppl like that part of it, you may consider adding it to yours :)
cheers
-Brandon
ForumDog
08-24-2006, 07:01 AM
i have just replaced the original code with the new one you posted.
the original code showed the "New Thread", the new one doesnt.
if i change this line in the new code from
<a href="newthread.php?$session[sessionurl]do=newthread&f=$forum[forumid]" rel="nofollow">$vbphrase[newthread]</a>
to
<a href="newthread.php?$session[sessionurl]do=newthread&f=$forum[forumid]" rel="nofollow">Start New Thread</a>
it works again.
$vbphrase[newthread] wrong??
Oops, that's the one. The phrase isn't wrong, but it's not a Global phrase so it only works on one of the forumbit types, if it's the top-level forumbit that shows on the index page it doesn't work. Just my luck to test it on the working one!
Well spotted, fixed thank you. Changed it back to ordinary text so it works on either forumbit.
OK, I just thought it was coincidence that it looks just like what Keith had sent me :P
I hadn't looked through the code, I just know it works..
BTW, what do u think about the RSS link thats in the code I posted ;) I know a lot of ppl like that part of it, you may consider adding it to yours :)
cheers
-Brandon
Yep, added it as an optional extra.
Update: Optional extras:
- Subscription code for each feed type, all conditionals so they'll only appear if you've turned that type on.
<if condition="$forum[statusicon]=='new' OR $forum[statusicon]=='old'">
<div class="smallfont">
<if condition="$forum[statusicon]=='new'"><a href="search.php?$session[sessionurl]do=getnew&include=f=$forum[forumid]">$vbphrase[new_posts_nav]</a> | </if>
<a href="newthread.php?$session[sessionurl]do=newthread&f=$forum[forumid]" rel="nofollow">New Thread</a>
<if condition="$show['searchbuttons']">| <a href="search.php?$session[sessionurl]f=$forum[forumid]" rel="nofollow">$vbphrase[search]</a></if>
<if condition="$vbulletin->options['externalrss']">| <a href="external.php?type=rss2&forumids=$forum[forumid]">RSS Feed</a></if>
<if condition="$vbulletin->options['externalxml']">| <a href="external.php?type=xml&forumids=$forum[forumid]">XML Feed</a></if>
<if condition="$vbulletin->options['externaljs']">| <a href="external.php?type=js&forumids=$forum[forumid]">JS Feed</a></if>
<if condition="$show['forumsubscription']">| <a href="subscription.php?$session[sessionurl]do=removesubscription&f=$forum[forumid]">$vbphrase[unsubscribe_from_this_forum]</a></if>
</if>
tekstylez
08-30-2006, 06:15 PM
i just tried to do the update, but now new posts is not working
Invalid Forum specified. If you followed a valid link, please notify the administrator
Which code do I replace the old code with? You may want to think of re-writting this update, it is very confusing
ForumDog
08-30-2006, 06:57 PM
i just tried to do the update, but now new posts is not working
Invalid Forum specified. If you followed a valid link, please notify the administrator
Which code do I replace the old code with? You may want to think of re-writting this update, it is very confusing
Oops, there was a typo. Corrected the first post and the text file, and re-ordered both to try to make things a bit clearer.
Use the first set of code (labelled AFTER, ADD:) if you want to reproduce the same function as the original code did, with the bugfix. Use the second, longer bit of code (labelled Optional Extras) if you would also like the above, plus links to be added for RSS/XML/JS feeds and Unsubscribe from this forum in the Subscribe part of the UserCP.
:)
tekstylez
08-31-2006, 02:14 AM
OK... it works now. But, is there any way to fix the issue of the search not working for subforums on the forumhome? In another words, if a forum is not active, and you click search... of course no results will show... but is there anyway to either disable it for non active forums or have it search all subforums also?
TheBlackPoet
09-15-2006, 06:32 AM
i never ever say anything negative about a hack.. as i am not smart enough to write one... but this hack.... scared the hell ouf of me... i loaded it.. and it looked good.. but something about it was right.... i went to delete the code.. and it duplicated on me....
i had to revert back to the original code. thankfully i didnt have any other scripts enbedded on that template....
ForumDog
09-30-2006, 04:37 PM
Hm. Don't know what happened to my subscription notification. :confused:
OK... it works now. But, is there any way to fix the issue of the search not working for subforums on the forumhome? In another words, if a forum is not active, and you click search... of course no results will show... but is there anyway to either disable it for non active forums or have it search all subforums also?
To make it search all subforums, add "&childforums=1" to the search URL.
Change this:
<if condition="$show['searchbuttons']">| <a href="search.php?$session[sessionurl]f=$forum[forumid]" rel="nofollow">$vbphrase[search]</a></if>
to this:
<if condition="$show['searchbuttons']">| <a href="search.php?$session[sessionurl]f=$forum[forumid]&childforums=1" rel="nofollow">$vbphrase[search]</a></if>
please ForumDog,
I want add some codes in this hack!
only for use in our site
any objection?
Thanks,
ForumDog
10-02-2006, 08:30 AM
That's fine. :)
Thanks,
See the small pictures
:cool:
ForumDog
10-02-2006, 01:41 PM
Very attractive! :cool:
gregsbaby64
10-04-2006, 11:53 AM
Thank you for this, just what I was looking for! :)
thanks,
nice mod, but can i make the font of New Thread | Search smaller?? as the forum gets confused with so many "New Thread | Search" repeating everywhere
if someone can help me plz.
GruntHalo
12-21-2006, 03:52 PM
Awesome, thank you alot for this hack. :)
admolot
08-11-2007, 05:28 AM
Nice, clicked installed.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.