Category Archives: Drupal

Global variable in Drupal module

There is something different in a variable between a variable in a Drupal module and a variable in a normal php file.
normal php

$_User = “user”;
function test() {
global $_User;
..
}

Drupal module

global $_User;
$_User = “user”;
function test() {
global $_User;
..
}

In Drupal module, I need the additional global $_User; Why?

Installing Drupal Module

Reference at Installing contributed modules.
I need to remember where to Enable the module. Version 5.x users go to administer > site building > modules.