Skip to content

Instantly share code, notes, and snippets.

@andeersg
Created June 24, 2013 07:54
Show Gist options
  • Save andeersg/5848422 to your computer and use it in GitHub Desktop.
Save andeersg/5848422 to your computer and use it in GitHub Desktop.
Check if Drupal 7 module is enabled.
/**
* param string $module
* Name of the module.
*
* return int
* 1 or 0
*/
function is_module_enabled($module) {
$result = db_query('SELECT s.status FROM system s WHERE s.name = :name AND s.type = :type', array(':name' => $module, ':type' => 'module'));
$record = $result->fetchObject();
return $record->status;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment