blob: d17b9ba12affe0374049125d8b44f42fb01022a0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
<?php
// $Id$
/**
* Implementation of hook_install().
*/
function forum_install() {
// Create tables.
drupal_install_schema('forum');
}
function forum_enable() {
// Create the forum vocabulary if it does not exist. Assign the vocabulary
// a low weight so it will appear first in forum topic create and edit
// forms.
$vid = variable_get('forum_nav_vocabulary', 0);
$vocabularies = taxonomy_get_vocabularies();
if (!isset($vocabularies[$vid])) {
$vocabulary = array(
'name' => t('Forums'),
'multiple' => 0,
'required' => 1,
'hierarchy' => 1,
'relations' => 0,
'module' => 'forum',
'weight' => -10,
'nodes' => array('forum' => 1),
);
taxonomy_save_vocabulary($vocabulary);
variable_set('forum_nav_vocabulary', $vocabulary['vid']);
}
}
/**
* Implementation of hook_uninstall().
*/
function forum_uninstall() {
$vid = variable_get('forum_nav_vocabulary', '');
// Delete the vocabulary.
taxonomy_del_vocabulary($vid);
db_query("DELETE FROM {node} WHERE type = 'forum'");
db_query('DROP TABLE {forum}');
variable_del('forum_containers');
variable_del('forum_nav_vocabulary');
variable_del('forum_hot_topic');
variable_del('forum_per_page');
variable_del('forum_order');
variable_del('forum_block_num_0');
variable_del('forum_block_num_1');
}
|