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:

to:

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 agree with MichaelFrey. Could it be implemented? --Kanakukk (talk) 10:44, 22 February 2013 (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)

Shouldn't this be a global flag in localsettings.php instead of changing the extension's code? --Yurik (talk) 14:28, 14 January 2013 (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)
 * This seems to be a bug in the extension:collection. See https://bugzilla.wikimedia.org/show_bug.cgi?id=24972 --Rrosenfeld (talk) 08:38, 25 April 2012 (UTC)
 * Just found a workaround: include DismissableSiteNotice before Collection in LocalSettings.php and the problem goes away. --Rrosenfeld (talk) 14:12, 25 April 2012 (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.
Note: The result of this discussion has been integrated into the extension on 2012-05-06. Here is the commit.

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)


 * I removed the section suggesting this from the extension page because I'm running into places that modified the extension and didn't match brackets and caused js errors and what not. Anyhow, I don't like suggesting patches on the official extension page. Bawolff 23:11, 5 February 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)

How can anons dismiss a notice?
So far only users can dismiss a notice. How can anonymous users dismiss a notice too? Think it should be possible since a cookie can also be saved on an anonymous visitor's disk... Thanks for your help! --Stefahn (talk) 16:02, 14 October 2012 (UTC)


 * Actually, this feature was removed from the extension, for some reason. If you want it, change the following in :
 * In line 15, add $wgDismissableSiteNoticeForAnons to the globals list (and in your  set  )
 * In line 28, change  to


 * Line numbers are based on this version of the file.
 * I hope I got it right, diff-wise - my version of the extension is different in several other aspects. --FreedomFighterSparrow (talk) 13:21, 15 October 2012 (UTC)

It works like a charm :) --Stefahn (talk) 18:42, 16 October 2012 (UTC)
 * Thanks for that great help, FreedomFighter!


 * I'm glad I could help. --FreedomFighterSparrow (talk) 22:06, 16 October 2012 (UTC)

It's unclear to me why this feature was removed: wikis rely heavily on it, it's nasty to force sitenotices on readers. I didn't notice till now. --Nemo 09:01, 29 November 2013 (UTC)


 * There was no reason given; it was done in one stroke with other (necessary) changes. I'll try to commit an update soon. --FreedomFighterSparrow (talk) 12:16, 1 December 2013 (UTC)
 * I second that, we really need to give a freedom to hide messages to non-signed users, otherwise keeping it for more then a few days becomes more of a nagscreen, for a lot of readers, who don't feel like becoming part of wiki-community. --Xelgen (talk) 22:38, 18 December 2013 (UTC)

For the latest version 1.28 20-apr-2017, the anon config is in extension.json, change to:

Cannot download
Download links for this extension do not seem to work. 70.208.136.178 13:53, 16 August 2014 (UTC)

How to reenable the sitenotice
I accidentally click the close button on a site, how can I enable it again?--一個正常人 (talk) 09:22, 28 January 2015 (UTC)
 * Shit, no one reply or help me...--一個正常人 (talk) 05:30, 19 February 2015 (UTC)
 * Delete your cookies, it is a cookie that hides it.--Jeffmcneill (talk) 04:09, 20 April 2017 (UTC)
 * Edit your MediaWiki:Sitenotice id page and increment the number (it's probably '0' at present), by 1. --Sabretache (talk) 05:53, 7 May 2015 (UTC)

Code missing
FI: The line of code referred to in Usage, concerning how to auto-set dismissal after every edit:

does not exist in my version (REL1_24 2014-12-02T00:17:36) of the extension DismissableSiteNotice.php --Sabretache (talk) 05:49, 7 May 2015 (UTC)


 * It wouldn't - it's now added as wgSiteNoticeId to the Javascript variables, and then the ResourceLoader module uses it to determine the display. If you need the auto-updating of the id, this should probably work:


 * --FFS Talk 10:53, 12 May 2015 (UTC)
 * I tested this out on MediaWiki 1.25.1 with DismissableSiteNotice 1.0.1 and it worked. Thank you!  Note that this code can be found in the DismissableSiteNotice.hooks.php and for my version it was line 26 instead of line 71. MikeDarling (talk) 04:11, 17 September 2016 (UTC)

Reset dismissal only if edit is not minor
Would it be possible to change the extension so that the dismissal was only reset by a non-minor edit to the sitenotice? In other words, any edit to the sitenotice would automatically cause it to re-display unless the edit was marked as "minor".

It seems to me this would be a more intuitive way to determine when the dismissal should be reset. (Not that I have a clue how this could be done.) Hylian King ZW (talk) 20:42, 7 July 2015 (UTC)

Works on mobile browsers, doesn't work on Chrome and IE
I'm running MW 1.28.2, I installed the DismissableSiteNotice extension and it seems to work appropriately on mobile browsers (Chrome on Android and Safari on iOS) but isn't working on desktops (Chrome or IE).

One additional note, even though MediaWiki:Anonnotice is not defined ("-"), the SiteNotice (not Anonnotice) is displayed for anonymous users until they log-in, then the SiteNotice disappears. --Bryandamon (talk) 06:15, 17 October 2017 (UTC)