Adding fields to the contact form in Drupal 7

Yesterday I was looking for a way to add a form field to the site-wide contact form in Drupal 7. All I could find (first 5 Google search results) were methods of doing this for Drupal 6. Using the example provided at How to Add a Field to the Drupal Contact form | Metal Toad Media and some snooping in /modules/contact/contact.module I came up with the following solution, enjoy!

* Implements hook_form_contact_site_form_alter().
* This function will add a phone number field to the site-wide contact form,
* by implementing hook_form_FORM_ID_alter().
function mymodule_form_contact_site_form_alter(&$form, &$form_state, $form_id) {

// Add a phone number field to the contact form.
$form['phone'] = array(
'#type' => 'textfield',
'#maxlength' => 20,
'#title' => t('Your phone'),

// Define the order of the top level elements on the form (include those from contact_site_form().
$order = array('name', 'mail', 'phone', 'subject', 'cid', 'message', 'copy', 'actions');

// Order the elements by changing their #weight property.
foreach($order as $key => $field) {
$form[$field]['#weight'] = $key;