function spamicide_install in Spamicide 7
Same name and namespace in other branches
- 8 spamicide.install \spamicide_install()
- 5 spamicide.install \spamicide_install()
- 6 spamicide.install \spamicide_install()
Implements hook_install(). Create the tables required for the spamicide module
File
- ./
spamicide.install, line 98 - This module provides yet another tool to eliminate spam.
Code
function spamicide_install() {
// insert some defaults and lock them
module_load_include('inc', 'spamicide');
$form_ids = array(
'contact_site_form',
'contact_personal_form',
'user_register_form',
'user_pass',
'user_login',
'user_login_block',
'forum_node_form',
);
foreach (node_type_get_names() as $type => $name) {
$form_ids[] = 'comment_node_' . $type . '_form';
}
foreach ($form_ids as $form_id) {
db_insert('spamicide')
->fields(array(
'form_id' => $form_id,
'enabled' => 1,
'removable' => 0,
))
->execute();
}
variable_set('spamicide_administration_mode', TRUE);
variable_set('spamicide_attempt_counter', 0);
variable_set('spamicide_dir', 'spamicide');
variable_set('spamicide_log_attempts', TRUE);
_spamicide_set_css_file('feed_me', 'create');
drupal_set_message(st('The installation of the spamicide table and some default entries was successful.'), 'status');
drupal_set_message(st('You can now <a href="@spamicide_admin">configure the Spamicide module</a> for your site.', array(
'@spamicide_admin' => url('admin/config/people/spamicide'),
)), 'status');
}