Extension:DismissableSiteNotice

The DismissableSiteNotice extension allows users to close the sitenotice, using cookies. When you add a new sitenotice and want everyone to see it, change the number on the created page MediaWiki:Sitenotice id by one (e.g. if it would be 5, you'd replace the page with the number 6 and so on).

Installation

 * 1) Download the files from SVN or download a snapshot (select your version of MediaWiki) and place the files under $IP/extensions/DismissableSiteNotice
 * 2) Add to the end of LocalSettings.php:
 * 3) Installation can now be verified through Special:Version on your wiki

Customization
The default dismiss button takes up 20% of the page and is centered. To move the dismiss button to the top right, and have it not take up a lot of space change the following:

Modify DismissableSiteNotice.php. Remove lines 63 and 64 and add everything below. document.writeln(' '); document.writeln(' '); // May need to modify img src to where ever your installation is located. document.writeln(''); document.writeln(' '); document.writeln("$encNotice"); document.writeln(' ');

Download the image found here: http://bits.wikimedia.org/skins-1.17/common/images/closewindow.png and add it to the DismissableSiteNotice folder.

meta.wikimedia.org and wikipedia have similar setups.

Redisplay the sitenotice whenever sitenoticed edited
The default behavior allows the site notice to be updated without forcing people who have dismissed it to see it again. Some sites may not need this as they may never make tweaks, updates or corrections to existing notices.

The below code change redisplays the sitenotice whenever the mediawiki:sitenotice content is edited. This eliminates the need for the "sitenotice_id" message entirely.

In DismissableSiteNotice.php change the one line of extension code:

$id = intval( $wgMajorSiteNoticeID ). "." . intval( wfMsgForContent( 'sitenotice_id' ) );

to:

$id = intval( $wgMajorSiteNoticeID ). "." . crc32( wfMsgForContent( 'sitenotice' ) );