Posted by fred | Posted in CMS, Code, Drupal, tutorial | Posted on 17-02-2012
Tags: #Drupal, #module, #uninstall

Challenge: Unable to uninstall one module from Drupal (checkboxes greyed out)
Solution: Run the uninstall hook from Drupal (see code below).
How To:
1. Delete the module files (your site > sites > all > module > module folder)
2. Enable the PHP input format for administrator (Configuration > Input format > CONTENT AUTHORING > Text Formats > Configure)
3. Create a new article
4. Paste the code below (update it with the name of the module you want to uninstall)
5. Preview the page
6. The module reference should be now removed properly.
7. Optionally, remove the administrator from the PHP input format.
NB: In the following example, replace storm by the name of the module you cannot uninstall.
/**
* Implements hook_uninstall().
*/
function storm_uninstall(){
// Use scheme API to delete database table
drupal_uninstall_schema(‘storm’);
// Delete our module’s variable from variables table
variable_del(‘storm_node_types’);
}
