Birthday block

Jump to: navigation, search

Note: You are currently viewing documentation for Moodle 1.9. Up-to-date documentation for the latest stable version is available here: Birthday block.

Birthday Block

In Moodle 1.8, if you use the user profile field to store a user's birthday or some type of anniversary date (formatted either as ISO YYYY-MM-DD, USA m.d.Y, or EUR d.m.Y), the Birthday Block (based off of the site_online_users block) will query the specified and configurable user profile field for the users whose birthday (or anniversary date) have the same month and day as the server's current time. 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 Birthday Block makes use of the custom user profile fields and allow you to create a field to hold the date of birth (or anniversary) for the user. The assumed, default shortname of the custom user profile field is DOB (i.e. date of birth). However, the birthday block allows for the custom user profile field's shortname to be configured so you can use Anniversary or any other descriptive name you choose. Since the data stored in the custom user profile fields is a text value (and not an actual date), the birthday block assumes that the data entered conforms to a valid date format (i.e. ISO, USA, or EUR). There is no data validation when the user enters the data and therefore I would recommend that the user not be able to edit the custom user profile field used by the Birthday Block.

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 profile field of type text input
  • Input the Shortname (for this block the default is DOB), Name (for example, Birthday), a description
  • I recommend that the field not be required, that it be locked, and visible to user
  • I have used the default category; however, you are free to organize these fields however you wish.
  • I recommend a blank default value, display size of 10, and maximum length of 10.
  • Click on the Save Changes button
  • In the Site Administration Block, click on Modules, Blocks, and the settings link for the Birthday block
  • Input the shortname of the profile field you created to store the birth dates
  • Enter the Birth Dates into the created user profile field
  • 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:

  • English
  • Spanish
  • French
  • Japanese
  • German
  • Italian
  • hu_utf8
  • sv_utf8

Advanced Options

It is possible to mass import the custom user profile field data when importing users. More detailed instructions are forthcoming.

To Do List

I would like to include the formating from styles.layout.css for the site_online_block directly into the block; however, I am not sure how best to accomplish this. I'm not sure how to possibly use html_attributes to get an effect similar to:

.block_birthday .listentry div.message {

 float:right;

}

.block_birthday .listentry div.user {

 float:left;
 font-size:0.75em;

}

Ultimately, I want to make sure that it is formatted identically to the site_online_users block. Any help with that would be greatly appreciated.


Contributor/Maintainer

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