Birthday block: Difference between revisions

From MoodleDocs
No edit summary
No edit summary
Line 1: Line 1:
==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 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 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.  
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===
===Installation===
Line 10: Line 10:
*Go to the \admin page and allow the block to be installed
*Go to the \admin page and allow the block to be installed
*Go to Users, Accounts, User profile fields
*Go to Users, Accounts, User profile fields
*Create a new profile field of type text input
*Create a new user profile date field  
*Input the Shortname (for this block the default is DOB), Name (for example, Birthday), a description
*Input a Shortname (for example, dob), Name (for example, Birthday), and a Description
*I recommend that the field not be required, that it be locked, and visible to user
*Generally speaking, it is recommended 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
*Click on the Save Changes button
*In the Site Administration Block, click on Modules, Blocks, and the settings link for the Birthday block
*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
*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 field
*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
*Add the Birthday block to your page to see a list of those celebrating birthdays


===Languages===
===Languages===


Thanks to the generosity of translators, the Birthday Block is available in:
Thanks to the generosity of translators, the Birthday Block is available in many languages:
*English
*English
*Spanish
*Spanish
Line 30: Line 28:
*German
*German
*Italian
*Italian
*hu_utf8
*and many more
*sv_utf8
 
If the block is not available in your language feel free to contact me so that we can create one.


===Advanced Options===
===Advanced Options===


It is possible to mass import the custom user profile field data when importing users. More detailed instructions are forthcoming.  
It is possible to mass import the user profile date field data when importing users. More detailed instructions are available on the [https://docs.moodle.org/20/en/Upload_users#Fields_that_can_be_included|Upload users] page.  


===To Do List===
===Styling===


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:  
Styling varies from theme to theme. The following has been setup in the birthday block's styles.php file:


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


.block_birthday .listentry div.user {
Some themes allow for the styles.css to be overridden or added to.  
  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 [User:Anthony_Borrow|Anthony Borrow].


===Contributor/Maintainer===
===See also===
The Birthday Block was contributed and is maintained by Anthony Borrow.
[http://moodle.org/mod/data/view.php?d=13&rid=901|Birthday block's Modules and Plugins database entry]


[[Category:Contributed code]]
[[Category:Contributed code]]

Revision as of 03:46, 31 July 2011

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.

Advanced Options

It is possible to mass import the user profile date field data when importing users. More detailed instructions are available on the users page.

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 [User:Anthony_Borrow|Anthony Borrow].

See also

block's Modules and Plugins database entry