Cancel button on drupal forms

This one is short but sweet. Usually drupal forms don't have cancel buttons that bring you back to previous page, so lets add one.

if ($form_id == 'user_profile_form'){
    $form['actions']['cancel'] = array(
          '#markup' => l(t('Cancel'), 'user'),
          '#weight' => '666',
          );
 }

This will appear on user edit form and bring you back to user page when clicked.