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: Birthday block.

Birthday block

From MoodleDocs
Revision as of 01:38, 30 December 2013 by German Valero (talk | contribs) (added link to spanish translation of document)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Birthday Block

The Birthday Block makes use of a user profile date field to store the date of birth (or anniversary) for each user. The Birthday Block alphabettically displays the user's full name with picture and the ability to click on the send message icon to directly send the user a Moodle message.

The settings page allows the site admin to select which user profile date field to use (currently only one can be used throughout the site). The data stored in the user profile date field is now a unix timestamp (this was not the case in the 1.9 version). Typically institutions auto-populate this field using a CSV upload of the data and then prevent the users from editing the data.

Installation

  • Copy the files into the \blocks folder.
  • Go to the \admin page and allow the block to be installed
  • Go to Users, Accounts, User profile fields
  • Create a new user profile date field
  • Input a Shortname (for example, dob), Name (for example, Birthday), and a Description
  • Generally speaking, it is recommended that the field not be required, that it be locked, and visible to user
  • Click on the Save Changes button
  • In the Site Administration Block, click on Modules, Blocks, and the settings link for the Birthday block
  • Select the newly created user profile date field you wish to use to store the birth dates
  • Enter the Birth Dates into the created user profile date field (or upload them via a CSV file)
  • Add the Birthday block to your page to see a list of those celebrating birthdays

Languages

Thanks to the generosity of translators, the Birthday Block is available in many languages:

  • English
  • Spanish
  • French
  • Japanese
  • German
  • Italian
  • and many more

If the block is not available in your language feel free to contact me so that we can create one.

Importing data

It is possible to mass import the user profile date field data when importing users. More detailed instructions are available on the Upload users page. In 1.9, the data imported was a text string of a date in either ISO, EUR, or USA format. In 2.0 and beyond, the data imported for the date of birth should be a Unix timestamp.

Styling

Styling varies from theme to theme. The following has been setup in the birthday block's styles.php file:

.block_birthday .listentry div.user { float: left; } .block_birthday .listentry div.message { float: right; }

Some themes allow for the styles.css to be overridden or added to.

Contributor/Maintainer

The Birthday Block was contributed and is maintained by Anthony Borrow.

See also

Birthday block's Modules and Plugins database entry