You are here

function honeypot_update_7002 in Honeypot 7

Update form names after upgrade from 6.x version.

File

./honeypot.install, line 89
Install, update and uninstall functions for the Honeypot module.

Code

function honeypot_update_7002() {
  $map = array(
    'user_register' => 'user_register_form',
    'contact_mail_page' => 'contact_site_form',
    'contact_mail_user' => 'contact_personal_form',
  );
  foreach ($map as $d6_name => $d7_name) {
    $value = variable_get('honeypot_form_' . $d6_name, 0);
    if ($value) {
      variable_set('honeypot_form_' . $d7_name, $value);
    }
    variable_del('honeypot_form_' . $d6_name);
  }
  $comment_form_value = variable_get('honeypot_form_comment_form', 0);
  if ($comment_form_value) {
    $types = node_type_get_types();
    if (!empty($types)) {
      foreach ($types as $type) {
        $d7_name = 'honeypot_form_comment_node_' . $type->type . '_form';
        variable_set($d7_name, $comment_form_value);
      }
    }
  }
  variable_del('honeypot_form_comment_form');
}