lundi 28 octobre 2013

[Drupal 7] database object requests

Here is a useful site to help you write Drupal 7 database object requests, generated from normal SQL requests. It saved my life !
http://dupgrade.com/tools/sql/inline

lundi 7 octobre 2013

[Drupal7] Redirect all anonymous users to login page

Without installing any module, add this three lines to your html.tpl.php :
if($GLOBALS['user']->uid==0 && current_path()!='user/login') {
    header("Location: " . $GLOBALS['base_url'] . '/user/login?destination=' . current_path());
}