function include_module

6.x misc.inc include_module($module, $bool_call_init = TRUE, $use_module_path = "")
4.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:

5 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.
fp_rebuild_modules_list in includes/db.inc
Re-query the modules table and re-add to our global array.
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.
system_enable_module in modules/system/system.module
Handles the enabling (and possible installation) of module.
system_handle_uninstall_module in modules/system/system.module
Called from the menu (ie, a URL) this function will uninstall a module.

File

includes/misc.inc, line 1316
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;
}