Archive for Drupal

Quickly install a new Drupal site (in a multisite environment) using Drush

Easy as that! Just replace with your own parameters!

drush site-install standard \
--site-name=FoobarSite \
--sites-subdir=foobar \
--db-su=adminuser \
--db-su-pw=adminuserpw \
--db-url=mysql://foobar:foobarpassword@localhost/foobar
――

How to add a Password reset link on user login block in Drupal

In Drupal 7, adding a link to allow users to reset their password (a “forgot my password” link) is quite easy through the hook_form_alter() hook.

/**
 * implements hook_form_alter().
 */
function mythemename_form_alter(&$form, &$form_state, $form_id)
{
  switch($form_id)
  {
    case 'user_login':
    case 'user_login_block':
      $form['links'] = array(
        array('#markup' => '<a href="/user/password/">Forgot your password?</a>'),
        '#weight' => 100,
      );
      break;
  }
}
――