The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Latest announcement on forum home Details »» | |||||||||||||||||||||||||
This is my first hack which I created out of necessity. It's is so simple, it adds "Last Announcement" in the forums home. This is done by selecting the latest thread created in a given forum to be displayed.
See the screenshot attached. 1.2 Update: - The hack now uses the plugin system, no more code changes . 1.1 Update: - Code is now more optimized, compatible with non-cookied and clustered boards. (Thanks for KirbyDE) 1.01 Update: - Now it works if you use prefix in database. Enjoy Show Your Support
|
Comments |
#22
|
|||
|
|||
Quote:
|
#23
|
|||
|
|||
Nice plugin.
But I would need some additional features. -) I have a multilanguage forum. So I would need that the Announcement changes depending on the forum language (so that I can enter for each language a forum where the last topic is taken for the annoucement). -) I want that I can change the number of topics displayed in the annoucement field. |
#24
|
|||
|
|||
This is a cool and simple hack. Could use a bit more functionality but I'm going to try to edit that in myself. I'll post the results here if I come up with something good.
|
#25
|
|||
|
|||
Edit: Alright, I've been playing around with this. It's probably nothing remarkable but I'm pretty proud of myself as I don't know mySQL or PHP and I had to do this via trial/error and am learning my way around.
This is my first experience in actually coding something in mySQL/php - all I've ever done before was move stuff around or follow file edit instructions. Anyway - here's what I've gotten so far: Attachment 51050 I did all this by editing the plugin code and the template code. Here is what I have for both: Code:
<!-- Latest Announcement --> <table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center"> <thead> <tr> <td class="tcat" colspan="2"><a href="http://www.pokerealm.net/forums/forumdisplay.php?f=28">Latest News and Announcements</a></td> </tr> </thead> <tbody id="collapseobj_forumhome_events" style="$vbcollapse[collapseobj_forumhome_events]"> <tr> <td class="thead" width="3%"> </td> <td class="thead" width="97%">Recent Headlines</td> <tr> <td class="alt2" align="center"><img class="inlineimg" src="$stylevar[imgdir_statusicon]/announcement.gif" alt="News Icon"></td> <td class="alt2">$lns_show</td> </tr> <tr> <td class="alt1" colspan="2"><div class="smallfont">$lns2_show</div></td> </tr> <tr> <td class="alt2" align="center"><img class="inlineimg" src="$stylevar[imgdir_statusicon]/announcement.gif" alt="News Icon"></td> <td class="alt2">$lnsb_show</td> </tr> <tr> <td class="alt1" colspan="2"><div class="smallfont">$lnsb2_show</div></td> </tr> </tbody> </table> <!-- /Latest Announcement --> Code:
// ### LATEST NEWS BY TANTAWI ############################################ $latesta = $db->query_first('SELECT title,threadid,views,replycount FROM ' . TABLE_PREFIX . 'thread WHERE 1 AND forumid = 28 ORDER BY dateline DESC LIMIT 0 , 1'); $lns_show = "<a href=\"showthread.php?" . $vbulletin->session->vars['sessionurl'] . "t=$latesta[threadid]\">$latesta[title]</a>"; $lns2_show = "<b>Replies:</b> $latesta[replycount] <b>Views:</b> $latesta[views]"; $latesta2 = $db->query_first('SELECT title,threadid,views,replycount FROM ' . TABLE_PREFIX . 'thread WHERE 1 AND forumid = 28 ORDER BY dateline DESC LIMIT 1 , 1'); $lnsb_show = "<a href=\"showthread.php?" . $vbulletin->session->vars['sessionurl'] . "t=$latesta2[threadid]\">$latesta2[title]</a>"; $lnsb2_show = "<b>Replies:</b> $latesta2[replycount] <b>Views:</b> $latesta2[views]"; I plan on adding a lot to this - I'm even thinking of asking someone how to trim phrases in PHP so that I can draw from the database and get the first post then trim it to 150 characters or so and display it right there under the title then a link "Read more...". -Whoops, didn't mean to double post. I thought it would auto merge my posts. |
#26
|
|||
|
|||
OK, I finally finished tinkering around with it and here is my finished product. If you have any questions, you can PM me. I'm not going to post it as a hack because I don't know how to write the admin CP plugin, etc. My code is probably very inefficient as well.
Attachment 51182 |
#27
|
|||
|
|||
This won't work for 3.6 - anyone have any ideas what changes I need to make to get it working? The Latest Announcement box will show but it's empty even though I have put in the correct forumid.
|
#28
|
|||
|
|||
mshadows, It works for me on on 3.6, nothing changed, you may need to rebuild threads info.
Regards. |
#29
|
|||
|
|||
What do you mean by rebuild threads info? Sorry I'm a bit of a newbie with this kind of stuff.
|
#30
|
|||
|
|||
From your admincp, select Maintenance > Rebuild thread info.
Regards. |
#31
|
|||
|
|||
Anyone got a 3.7.3 version ?
|
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|