You are here

function group_uninstall in Group 7

Implements hook_uninstall().

See also

hook_group_uninstall()

1 string reference to 'group_uninstall'
group_hook_info in ./group.module
Implements hook_hook_info().

File

./group.install, line 44
Install, update and uninstall functions for the Group project.

Code

function group_uninstall() {
  variable_del('group_admin_theme');
  variable_del('group_pm_group_view_disabled');

  // Bypass entity_load() as we cannot use it here.
  $types = db_select('group_type', 'gt')
    ->fields('gt', array(
    'name',
  ))
    ->execute()
    ->fetchCol();

  // Delete the attached fields from the group types.
  foreach ($types as $name) {
    field_attach_delete_bundle('group', $name);
  }

  // Run hook_group_uninstall() to allow other modules to clean up.
  $gids = db_select('groups', 'g')
    ->fields('g', array(
    'gid',
  ))
    ->execute()
    ->fetchCol();
  module_invoke_all('group_uninstall', $gids);
}