Note: You are currently viewing documentation for Moodle 3.7. Up-to-date documentation for the latest stable version of Moodle may be available here: RememberMe.

RememberMe

From MoodleDocs
Revision as of 16:09, 27 June 2016 by Pro Plug (talk | contribs)
RememberMe
Type Block
Set N/A
Downloads N/A
Issues N/A
Discussion N/A
Maintainer(s) Pro Plug

Note: This page is a work-in-progress. Feedback and suggested improvements are welcome. Please join the discussion on moodle.org or use the page comments.


Overview

RememberMe is a block type plugin for Moodle v2.0 made by students of the Berlin School of Economics and Law. It periodically checks if a user has not logged in for a specified amount of time and if so, it sends a reminder email to this user. Both the time without log-in required to trigger the reminder, as well as the content of the email can be customised.

Installation

The plugin directory must be moved into .../moodle/blocks/. There are several ways to achieve this.

You can install directly from the Moodle plugins directory. To do this, log into your Moodle as admin, go to Site administration > Plugins > Install plugins and click the button 'Install plugins from Moodle plugins directory'. Search for the plugin and click the install button.

You can also use the Install plugins page to upload and install the plugin after you have downloaded it from the Moodle plugins directory. Simply drag and drop the ZIP file containing the RememberMe directory into the given field, or use the 'Choose a file...' button.

Alternatively, you can do it manually. Download the ZIP from the Moodle plugins directory, unzip it and move or copy the uncompressed folder into .../moodle/blocks/. Then, log into your Moodle as admin and go to Settings > Site administration > Notifications. You should get a notification about a new plugin beeing installed.

For more in-depth step-by-step instructions about installing block plugins, see [1]

Usage

If this plugin is active and was installed correctly, you'll see a new block in your moodle course. Clicking on the logo will link you to this very page.

Configure the settings file ("settings.xml") to customise the amount of days that should pass before a message is sent and the contents of the message.
To do the first, you simply need to change the value for <login>.
The text in the message can be changed by editing the presets <text1> and <text2>.
By default, <text1> is a formal message while <text2> is more casual.

Technical Details

List of important parameters:
'$xml' → Shows the path to the data „settings.xml“
'text'→ contains the reminder text for the Email
'login' → contains the count of days for the variable 'days'
'$days' → exports the count of days, which is necessary to trigger the function
'lastaccess' → contains the Unix- Timestamp of the user's previous activities
'$seconds' → calculates, after what time span the function is triggered
'$date' → exports the present time in Unix-Timestamp-Format
'time' → present Unix-time in seconds

Both 'time' and 'lastaccess' are Unix-Timestamps, meaning that their values are the seconds that have passed between the beginning of the Unix-period (01.01.1790 - 00:00 o‘clock UTC) and the point in time these timestamps refer to. As a result, the plugin uses seconds as unit of measurement when calculating.

The plugin gets executed every 12 hours by a Cronjob. When this happens, the timestamp of each user's last login is compared with the difference between the current time and the time that is required to elapse before an email is triggered, to check if a user matches this requirement (in short, if $date - $seconds ≥ 'lastaccess'). If so, an email containing the message specified in the settings file is composed and sent. To do the latter, the plugin uses the PHPMailerAutoload class.

Example:
Let's assume today is the 1st of april, 2016 at 6:00am.
-> $date = 1459483200
The user in question has last logged in on the 30th of march, 2016 at 15:15pm.
-> lastaccess = 1459343700
The admin wants everyone who has not visited moodle for 5 days to receive a message.
-> $days = 1 -> $seconds = 86400

1459483200 - 86400 = 1459396800
1459396800 > 1459343700

The condition of $date - $seconds ≥ 'lastaccess' is met and a message will be sent.

It should be noted that the plugin overwrites the 'lastaccess' variable when sending an email, to prevent another one from beeing sent when the plugin is executed the next times.