You are here

function uc_googleanalytics_enable in Ubercart 7.3

Same name and namespace in other branches
  1. 6.2 uc_googleanalytics/uc_googleanalytics.module \uc_googleanalytics_enable()

Implements hook_enable().

File

uc_googleanalytics/uc_googleanalytics.install, line 11
Install, update and uninstall functions for the uc_googleanalytics module.

Code

function uc_googleanalytics_enable() {

  // Get the weight of the Google Analytics module.
  $weight = db_query("SELECT weight FROM {system} WHERE name = :module", array(
    ':module' => 'googleanalytics',
  ))
    ->fetchField();

  // Update the weight of the UC Google Analytics module so its hooks get called
  // after the actual Google Analytics module.
  db_update('system')
    ->fields(array(
    'weight' => max(1000, $weight + 1),
  ))
    ->condition('name', 'uc_googleanalytics')
    ->execute();
}