Extension talk:DismissableSiteNotice/Archive

Can install directions be included for those of us who are just marginally capable of adding extensions to our wikis? :) --PurplePopple 00:16, 29 December 2007 (UTC)

Increment ID of MediaWiki:Sitenotice
Hello, after installation of this Extension i added text to MediaWiki:Sitenotice. I sucessully clicked the dissmiss -link at the top right, but i now do not know how to add another Sitenotice? If a add MediaWiki:Sitenotice 2 it is not displayed at the top of the page. So, can any1 answer the question how to add a new Sitenotice if the user dismissed the first one?

Thanks in advance kind regards TurboKanne


 * No, that's not how you do it. You edit MediaWiki:Sitenotice on your wiki as normal, add the new notice there and whatever you like. Then you go to MediaWiki:Sitenotice id on your wiki and increment the number there by one. For example, if it is 1, you replace the number 1 by the number 2 and then everyone will see your new sitenotice. -- Sayuri 12:16, 3 February 2008 (UTC)


 * Thanks, now i understood. I thought i have to replace the "id" by an incremental number. this was what confudes me. i checked it with your help and it works great. Thanks a lot for your quick response.
 * kind regards
 * TurboKanne

An alternative to MediaWIki:Sitenotice_id
Change the one line of extension code:
 * $id = intval( $wgMajorSiteNoticeID ) . "." . intval( wfMsgForContent( 'sitenotice_id' ) );

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

This should eliminate the need for the "sitenotice_id" message entirely by calculating a checksum-like value and using it to force the redisplay of the sitenotice whenever its content is changed in any manner. --Carlb 21:37, 24 March 2008 (UTC)


 * That is so easy and logical, rather than farting around changing the id...worked for me
 * Should be included in main code and remove reference/need for id


 * Great work, lovely little extension --HTPCnz 00:46, 22 June 2008 (UTC)


 * I think different, not every edit on the Site Notice need to redisplay the Site Notice.
 * For example simple fixing of spelling misstakes or removing of 1 of 2 messages. (With hidding the user confirmed for him self, that he read both measeges)
 * When a user hide for example the notice about the Board Vote, then he don't care when there some one fix a spelling misstake.
 * -- MichaelFrey 07:42, 22 June 2008 (UTC)

I found this to be Extremely useful, especially since site id doesn't seem to work very well for me. I added it to the main page: Igottheconch 05:16, 11 November 2011 (UTC)
 * discussed on my talk page. Igottheconch 20:16, 14 November 2011 (UTC)

Dismiss SiteNotice hides the pdf book making extension:collection too
The extension works fine. But, if the "create book" function of the extension:collection is aktive, the "dismiss"-Buton hides the Sitenotice AND the frame for the pdf book extension. Why? How this behavior can be avoided? Kind regards --Jostar 07:47, 11 August 2010 (UTC)

Strange behavior in Firefox
I'm testing my MediaWiki 1.16 with DismissableSiteNotice in Safari and Firefox. Safari perfectly displays a "dismiss" link, while Firefox does not. Firebug reveals that the page source code is different, and does not contain a table tag in the firefox version. XApple 03:56, 24 September 2010 (UTC)
 * Damn it, I was logged in as a user in one browser and not in the other, that's why ! But the description of your extension never specifies that the cookie is user-centered instead of browser-centered. XApple 04:00, 24 September 2010 (UTC)

Just a tip
It looks logical to move JS code to a static file (reduces size of all pages for logged-in users, this file will be cached etc.). Wassily Steik 17:33, 7 October 2010 (UTC)

Tableless design with image close button.
I hate tables and didn't like how it wasted so much room (20%) to the text-dismiss link. The code below modifies it and changes it to a floating image (top right).

This technique works best if you have a div within sitenotice thats 100% wide(or no width defined)

Modify DismissableSiteNotice.php and remove lines 65 and 66 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(' ');

The image isn't included with the default download, just place it in the /extensions/DismissableSiteNotice folder.

I had uploaded it to MediaWiki at the correct viewing size (16x16 px) but someone felt since it was already there (just way too big) they pulled it. So i've put it here: http://imgur.com/9KdWw.png If the image fails it defaults to [dismiss]

--Iarp 14:15, 22 October 2010 (UTC)


 * Fantastic, thanks for this! Formina Sage 23:07, 2 June 2011 (UTC)
 * Incredible, since wikipedia and mediawiki do something similar, I added this to the main page!
 * For the x image, I changed the image name, which is now at http://bits.wikimedia.org/skins-1.17/common/images/closewindow.png
 * small change, if you don't download the image and want an x instead of dismiss, change to:

document.writeln(''); document.writeln(' '); document.writeln("$encNotice"); document.writeln(' ');
 * Igottheconch 18:49, 29 August 2011 (UTC)

I want to add the following suggestion for a 80% dynamic width SiteNotice box that still scales well with any layout. In my case the X button moves with it just right. This is tested in IE 8.0 and Chrome 14. Replace the PHP file: document.writeln(' '); This will make your X-Button appear "within" your 80% box, just in the corner. When using this, make sure your text in the box is formatted right, so it doesn't go "under" the x. Something in the lines of style="padding-left:15px; padding-right:25px" will do just right.

You guys should check out bug 24066 and probably vote/comment there. --Waldir 22:05, 17 January 2012 (UTC)

Conflict with Extension:SemanticForms
I found that the dismissible site notice broke the preview functionality of SemanticForms when attempting to view a preview (saving seemed unaffected). To fix this, I made the following change: DismissableSiteNotice\DismissableSiteNotice.php:

@17 ++   global $wgRequest; if ($wgRequest->getText( 'action' )=='submit'){ return false; } This worked for me, unless someone has a better solution.  Thorncrag    19:49, 29 June 2011 (UTC)