DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:message

Message Plugin

Compatible with DokuWiki

  • 2024-02-06 "Kaos" unknown
  • 2023-04-04 "Jack Jackrum" unknown
  • 2022-07-31 "Igor" unknown
  • 2020-07-29 "Hogfather" no

plugin Displays a message on all pages, for all users

Last updated on
2009-08-04
Provides
Action

:!: Two corrections are needed in action.php to make this old plugin work again:

  1. on line 38 replace
    function register(&$contr)
    by
    function register(Doku_Event_Handler $contr)
  2. on line 42 replace
    function _display_message(&$event, $param) {
    by
    function _display_message(Doku_Event $event, $param) {

Also you can add this free plugin's SVG-icon for admin panel to the plugin's root. Don't forget to check the content, there 585 bytes of normal SVG-code

Description

  • action: displays the message(s) contained into the message_error.txt, message_info.txt, message_valid.txt and message_remind.txt files stored under the data/cache folder.
  • The messages appear on every page, for all users.

Example

Screenshot

Version history

  • 2008-10-07: first one!
  • 2009-03-11: manage the messages in the admin section.
  • 2009-08-04: The txt messages files are now stored in $conf['cachedir'] (and no more in the plugin folder. Thanks to Christophe M). Improved compatibility of the admin screen with templates.

Discussion

  • It says above that the message files are named e.g. error.txt, shouldn't it say e.g. message_error.txt ?
  • Tell me…
    • It would be great to know where to put this in the DokuWiki directory structure. Sorry, I have a problem with the plugin manager not installing this plugin correctly.
      • Zip up the plugin directory and any children, but no parents. Take a look at some other plugin packages to see how they are done. — Christopher Smith 2009/01/21 09:39
    • It would be great to be able to manage these messages in the admin section. Not very friendly to edit the text file directly. Especially remotely. — Alexandre Fremion 2009/02/23 18:36
      • This will be possible in a upcoming new version. — Etienne M. 2009/03/09 14:12

Make message dismissable

It would be nice to make the messages dismissable. Perhaps a checkbox besides each message in the admin section to toggle this function on/off. I personally see many use cases for this, but realise it is a long shot, considering that the developer hasn't updated his plugins in several years. Anyways, I am still happy with the plugin as it is now. Thanks! — Eivind 2016-01-09 16:35

Display based on time

While I'm at it, why not ask for time based messages as well? For instance, I'd like a message to appear only on a set date, and disappear the following day. I'm not expecting recurring messages, as that would likely be grounds for a new plugin, just the possibility to set a start and end time for each message. — Eivind 2016-01-09 16:44

Disable when not logged in

To prevent these messages from showing up when not logged in, modify the _display_message function in action.php:

    function _display_message(&$event, $param) {
        global $conf;
        global $ID;
        $perm = auth_quickaclcheck($ID);
            if($perm > AUTH_NONE){

                $file=$conf['cachedir'].'/message_error.txt';
                if (file_exists($file) && filesize($file)) msg(@file_get_contents($file),-1);

                $file=$conf['cachedir'].'/message_info.txt';
                if (file_exists($file) && filesize($file)) msg(@file_get_contents($file),0);

                $file=$conf['cachedir'].'/message_valid.txt';
                if (file_exists($file) && filesize($file)) msg(@file_get_contents($file),1);

                $file=$conf['cachedir'].'/message_remind.txt';
                if (file_exists($file) && filesize($file)) msg(@file_get_contents($file),2);
                
            }
        return;
        

briangig 2017-02-22 06:33

Requested compatibility with Translation Plugin

It would be nice to introduce language divised notes for sites with multilanguage support.

Bell icon for the admin panel

Bell icon for the admin panel Save this as %your_domain%/lib/plugins/message/admin.svg and look at %your_domain%/doku.php?do=admin. Freeware.

Screenshot:

Screenshot

plugin/message.txt · Last modified: 2024-01-23 13:43 by Aleksandr

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki