Alert message box prior to log in

Alert message box prior to log in

by Lauralee Grace -
Number of replies: 3

We are currently using Moodle 1.9 and use Moodle to deliver mandatory training to our staff. 

Recently our department engaged a external 3rd party to create and host online orientation for new staff. 

There seems to be confusion with people trying to log into Moodle to complete their mandatory training. I need an alert (pop up message box) to tell people that if they are looking for orientation online they are at the wrong site. 

I have managed to get a pop up to work, but as it is in the header of the theme it keeps alerting on every page. I have tried using cookies but it doesn't seem to help.

Once someone is logged in I don't want the alert to show. Has anyone done this or can anyone give me some ideas on how to get this to happen?

thanks

Laurie

Average of ratings: -
In reply to Lauralee Grace

Re: Alert message box prior to log in

by Onno Schuit -

In the header of your theme, use a Moodle (php) function to check if somebody is logged in. If not, output the code for the alert (presumably javascript?).

Here's an example:

<?php if (!isloggedin()) { ?>

<script type="text/javascript">

alert("Please log in!")

</script>

<?php } ?>

The exclamation mark (!) in front of the function means "NOT", so read this as "if not logged in, output everything between the curly brackets".