General plugins (Local): Environment bar

Maintained by Picture of Catalyst ITCatalyst IT, Picture of Nicholas HoobinNicholas Hoobin, Picture of Brendan HeywoodBrendan Heywood, Picture of Dmitrii MetelkinDmitrii Metelkin
Warn users with a notification block across the top of the screen when you're browsing a non-production server like staging or a local development box.
138 sites
14 fans
Moodle 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9

Environment bar - Moodle local plugin

This displays a configurable fixed div across across the top of your Moodle site which can change depending on where it has been deployed.

This is useful with development and production for identifying which server you currently reside on based on the URL.


Showing what environment you are in needs to be reliable. If it doesn't work for any reason then you may as well not have it. The way this plugin works is that in your production system you specify what your different environments are. Then after a refresh of production data back to a staging environment it can auto detect that it is no longer in production and warn the end user. Further more if there isn't any config at all, then it will assume you are in a development environment.

By doing it this way, by saying 'Are we not in production' vs 'Are we in a dev environment' the logic becomes much more resilient to mistakes, refreshed databases, and still works even if you forget to do anything and just have a fresh database. ie it is the only near perfect fail safe way to detect a non-production environment.


Screenshot #0
Screenshot #1
Screenshot #2


Picture of Catalyst IT
Catalyst IT (Lead maintainer)
Picture of Dmitrii Metelkin
Dmitrii Metelkin
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of Plugins bot
    Fri, Mar 11, 2016, 8:01 PM
    Prechecker results: 28 errors/1 warnings

    Please consider adding a full description of the plugin. You can describe the plugin's features, purpose and typical usage scenarios there, for example.
  • Picture of David Mudrák
    Fri, Mar 11, 2016, 8:10 PM

    Thanks guys for sharing the plugin with the community. I can see its potential usefulness in certain Moodle development setups. Although I personally prefer injecting these things directly via the main config.php, rather than having a plugin installed for it.

    I have to ask you for better description of the plugin here prior to approving it. It should be clear that this plugin is intended for developers and development installations only. I do not think it is intended for production environments is it?

  • Picture of Dan Marsden
    Wed, Apr 6, 2016, 7:34 AM
    Thanks for updating the description - good to see the travis-ci checks passing too! - I've tested this plugin and it appears to work well.

    I like the fact that this code-base and configuration can sit on both development and production branches - allowing you to duplicate the production database and display the correct bar on the development/testing systems. I can see it being a useful plugin and I think this is ready for approval in the plugins db

    I agree with David though - I prefer to manage this sort of thing from config.php (preventing changes to the config by normal Moodle admins) - I wonder if an idea for future development of this would be to allow hard-coding values for this plugin in config.php
  • Picture of Brendan Heywood
    Wed, Apr 6, 2016, 8:30 AM
    Thanks Dan, we are adding an optional $CFG->local_envbar_items config item so you can do it either way.
  • Picture of Yezi Yang
    Wed, Jun 22, 2016, 2:58 PM

    I really like this plugin. The institution I work in will start to use it in the coming September semester. However, there is a bug that when the message in the environment bar is long, the envbar will cover the user name. It is a big problem since users need to click their user name in the banner for dashboard, grade and logout. Here is an screen shot of the bug. Since it does not support to upload images in the message forums, I uploaded the screen shots to a cloud storage.

    I am really looking forward that you can solve the problem as soon as possible. Thank you very much.
  • Picture of Brendan Heywood
    Wed, Jun 22, 2016, 3:33 PM
    hi Yezi,

    I think you have misunderstood the intent of this plugin, it's not for giving messages to students in a real site. It should only ever show a warning in non-production environments.

    If you want to show a warning for impending outages or similar to students I'd suggest try experimenting with the 'additionalhtml' config item, or investigate another plugin better suited to this task.

    cheers Brendan
  • Picture of Yezi Yang
    Wed, Jun 22, 2016, 5:05 PM
    Hi Brendan,

    Thank you very much for your suggestion! The "additional html" item is quite useful.
  • Picture of Patrick Liersch
    Fri, Apr 7, 2017, 3:31 PM

    we search a Plugin to Display a Maintenance Date and Info, to a lot of Moodle Installations on the same Server.
    is this realizable with this Plugin?
  • Picture of Brendan Heywood
    Mon, Apr 10, 2017, 12:12 PM
    hi Patrick,

    No, the use case for this plugin is to help manage different environments of the same moodle, it's not for general purpose outage notifications.

    Recent versions of moodle have a simple built in outage notification message, have a look at:

    php admin/cli/maintenance.php -h
    --enablelater=MINUTES Number of minutes before entering CLI maintenance mode

    Or if you want a full blown outage manager solution have a look at this other plugin we maintain:
Please login to post comments