News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Posting Announcement

Started by Mick., October 28, 2008, 01:01:57 PM

Previous topic - Next topic

Arantor

Comma separated is relatively easy...

ModSettings.php
// The Posting Announcement mod
                        array('check', 'enable_announcement'),
array('large_text', 'text_announcement', '2'),
                        array('text', 'board_announcement'),


Modifications.english.php
// Start Posting Announcement mod by Nas
$txt['enable_announcement']='Show an announcement on the top of the post page';
$txt['text_announcement']='Announcement to display <div class="smalltext">HTML and BBC may be used.</div>';
// End Posting Announcement mod by Nas
$txt['board_announcement']='Board ID(s) to display the announcement';


Post.template.php
// Posting Announcement
$board_announce_this_board = false;
if (!empty($modSettings['board_announcement']))
{
$modSettings['board_announcement'] = preg_replace('~[^0-9,]~', '', $modSettings['board_announcement']);
$boards_announce = explode(',', $modSettings['board_announcement']);
$board_announce_this_board = in_array((string) $context['current_board'], $boards_announce);
}
if (!empty($modSettings['enable_announcement']) && $board_announce_this_board)
echo '
<tr>
<td></td>
<td align="left">
<img src="', $settings['images_url'], '/icons/assist.gif" /> <b>',parse_bbc($modSettings['text_announcement']),'</b> <br /><br />
</td>
</tr>';


In case anyone's curious WTF that's going, first it checks to make sure there's actually something in the modSettings[] item, if there is, strip out anything that isn't a number or a comma (like spaces), split it up into an array (which, btw, are going to be strings), then do a comparison of the current board, converted to a string so it's the right type, against the array.

Not tested though.

KidCactus

Quote from: Arantor on May 19, 2010, 08:30:15 AM
Not tested though.
I just tried your edit and I can confirm that it works like a charm. :)

aw06

I also have this working flawlessly on 1.1.11
:: ShopinJA.com Powered by SMF 1.1.19 | Ig-Oh Theme by Koni | 70 Rock Solid Error Free Mods | Many Custom Edits & Tweaks ::
- Host Unlimited Websites - Free Website Builder & Templates - Unlimited Disk Space & Bandwidth

gisfreak

hem, how to upgrade it to latest version ?

should i uninstall it first?, coz it said failed in some file  :(
Me fail English? That's unpossible.

Vincent Volmer

Hello,

Is this mod updated for SMF2.0 RC5?

Thanks,

Vincent

Mick.

Quote from: Vincent Volmer on March 10, 2011, 05:31:18 AM
Hello,

Is this mod updated for SMF2.0 RC5?

Thanks,

Vincent
It installs on any RC 2.0. ;)

Vincent Volmer


Mick.


Adonix

Could we get any updated version for this mod :\ ?
This mod is nice but will it work with 2.0.11 SMF version Mick ?

br360

This mod does work fine with 2.0.11.

Grammy

Okay, this is VERY nice!   :)

Mick.


Advertisement: