Archive for Tips

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 \

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)
    case 'user_login':
    case 'user_login_block':
      $form['links'] = array(
        array('#markup' => '<a href="/user/password/">Forgot your password?</a>'),
        '#weight' => 100,

CSS3 box-shadow on left and right sides only

It is possible to have inset shadows on both left and right sides of a block. It is a matter of showing only one side of the box-shadow at a time, and so you need two box-shadows (one for each side of the block you wish to have shadows, and we can put both CSS codes in the same property).

Here is an example that should be compatible with Firefox, Chrome and Opera.

box {
        inset 5px 0 5px -5px #333,
        inset -5px 0 5px -5px #333;
        inset 5px 0 5px -5px #333,
        inset -5px 0 5px -5px #333;
        inset 5px 0 5px -5px #333,
        inset -5px 0 5px -5px #333;

Here is the result:

Lorem ipsum…

Inspired from Playing with CSS3 box shadow []


How to optimize all tables from all databases

The following command will optimize all of your databases’ tables within MySQL.
It is important to optimize tables to reduce data fragmentation.

mysqlcheck -Aop -uroot

If you are not using root replace it with your username.

-A : Check all tables in all databases. This is the same as using the –databases option and naming all the databases on the command line.
-o : optimize the tables.
-p : Prompts for a password to use when connecting to the MySQL server.
-u : The MySQL user name to use when connecting to the server.

Inspired by this article.