You are here

function login_destination_update_7000 in Login Destination 7

Update login_destination variables.

File

./login_destination.install, line 112
Install, update and uninstall functions for the Login Destination module.

Code

function login_destination_update_7000() {
  $type = variable_get('ld_condition_type', 'always');
  $snippet = variable_get('ld_condition_snippet', '');
  if ($type == 'snippet') {
    $form_state['values']['pages_type'] = 2;

    // We introduced php tags.
    $form_state['values']['pages'] = '<?php ' . $snippet . '?>';
  }
  elseif ($type == 'pages') {
    $form_state['values']['pages_type'] = 1;
    $form_state['values']['pages'] = $snippet;
  }
  else {
    $form_state['values']['pages_type'] = 0;
    $form_state['values']['pages'] = $snippet;
  }
  $type = variable_get('ld_url_type', 'static');
  $snippet = variable_get('ld_url_destination', '');
  if ($type == 'snippet') {
    $form_state['values']['destination_type'] = 1;

    // Syntax for return value has changed.
    $form_state['values']['destination'] = '<?php /* ' . $snippet . ' */ ?>';
  }
  else {
    $form_state['values']['destination_type'] = 0;
    $form_state['values']['destination'] = $snippet;
  }
  $form_state['values']['triggers'] = serialize(array(
    'login',
  ));
  $form_state['values']['roles'] = serialize(array());
  drupal_write_record('login_destination', $form_state['values']);
  variable_set('login_destination_preserve_destination', variable_get('ld_destination', 0));
  variable_del('ld_condition_type');
  variable_del('ld_condition_snippet');
  variable_del('ld_destination');
  variable_del('ld_url_type');
  variable_del('ld_url_destination');
}