function hook_init

Allows each module to execute code when the module is first loaded.

Typically, this means that we will execute code when the page is first loaded. Also useful for including javascript or CSS on the page, but only under certain conditions (like who the user is, or what permissions they have)

See also

hook_exit

6 functions implement hook_init()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

advise_init in modules/advise/advise.module
Implementation of hook_init
example_helper_init in custom/modules/example_helper/example_helper.module
Implementation of "hook_init".
masquerade_init in modules/masquerade/masquerade.module
schools_init in modules/schools/schools.module
Implements hook_init
system_init in modules/system/system.module
Called on every page load.

... See full list

File

includes/hook.api.php, line 565
Lists all available hooks within FlightPath's core code.

Code

function hook_init() {
  // Perform actions when page is loaded...
  if (user_has_access("some_permission")) {
    $GLOBALS ["some_variable"] = TRUE;
  }
}