You are here

function optimizely_account_settings_form_submit in Optimizely 7.2

Same name and namespace in other branches
  1. 7.3 optimizely.admin.inc \optimizely_account_settings_form_submit()

Process submisison from optimizely_setup_account_settings_form form. This includes saving the entered Optimizely account ID to the varable database table, updating the default optimizely (oid) record with the project ID which is also the account ID.

File

./optimizely.admin.inc, line 330
Admin page callback for the Optimizely module.

Code

function optimizely_account_settings_form_submit($form, &$form_state) {

  // Write the variable table
  variable_set('optimizely_id', $form_state['values']['optimizely_id']);

  // Update the default project / experiement entry with the account ID value
  db_update('optimizely')
    ->fields(array(
    'project_code' => $form_state['values']['optimizely_id'],
  ))
    ->condition('oid', '1')
    ->execute();

  // Inform the administrator that the default project / experiement entry is ready to be enabled.
  drupal_set_message(t('The default project entry is now ready to be enabled. This will apply the default Optimizely project tests site wide.'), 'status');

  // Redirect back
  $form_state['redirect'] = 'admin/config/system/optimizely';
}