You are here

function _optimizely_update_oid in Optimizely 7.3

Set the Optimizely oid (account ID and default project ID).

@parm $oid An oid provided by Optimizely.

2 calls to _optimizely_update_oid()
optimizely_account_settings_form_submit in ./optimizely.admin.inc
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.
optimizely_set_id in ./optimizely.drush.inc
Callback function for optimizely-set-id command.

File

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

Code

function _optimizely_update_oid($oid) {

  // Create entry in "variable" table.
  variable_set('optimizely_id', $oid);

  // Update the default project / experiment entry with the account ID value.
  $result = db_update('optimizely')
    ->fields(array(
    'project_code' => $oid,
  ))
    ->condition('oid', '1')
    ->execute();
}