function include_module

7.x misc.inc include_module($module, $bool_call_init = TRUE, $use_module_path = "")
6.x misc.inc include_module($module, $bool_call_init = TRUE, $use_module_path = "")
5.x misc.inc include_module($module, $bool_call_init = TRUE, $use_module_path = "")

This will find and include the module in question, calling it's hook_init() function if it has one.

Will return TRUE or FALSE for success or failure to include the module.

If the use_module_path is set to some value, we will not attempt to use the setting for this module's path. Useful if we do not have the module in our modules table yet.

Example use: include_module("course_search");

Parameters

string $module:

7 calls to include_module()
bootstrap.inc in ./bootstrap.inc
This file should be included by every public-facing page of FlightPath. It will include all the classes, as well as settings and function files, and modules.
db.inc in includes/db.inc
This file contains mostly db shortcuts.
fp_rebuild_modules_list in includes/db.inc
Re-query the modules table and re-add to our global array.
system.module in modules/system/system.module
system_confirm_db_updates_form_submit in modules/system/system.module
Perform the actual hook_update calls here, send the user to a completed page.

... See full list

File

includes/misc.inc, line 1829
This file contains misc functions for FlightPath

Code

function include_module($module, $bool_call_init = TRUE, $use_module_path = "") {

  $system_path = trim($GLOBALS ["fp_system_settings"]["file_system_path"]);

  $module_path = $GLOBALS ["fp_system_settings"]["modules"][$module]["path"];
  if ($use_module_path != "") {
    $module_path = $use_module_path;
  }

  if ($module_path != "") {
    $path = $module_path . "/$module.module";


    if (file_exists($system_path . "/" . $path)) {
      require_once ($system_path . "/" . $path);
    }
    else {
      print "<br><b>Could not find module '$module' at '$system_path/$path'</b><br>";
    }
    // Now that we have included it, call the module's hook_init() method.
    if ($bool_call_init) {
      if (function_exists($module . "_init")) {
        call_user_func($module . "_init");
      }
    }
    return TRUE;
  }

  return FALSE;
}