### Eclipse Workspace Patch 1.0
#P drupal-contrib-5
Index: modules/google_analytics/googleanalytics.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/google_analytics/googleanalytics.module,v
retrieving revision 1.14.2.33
diff -u -r1.14.2.33 googleanalytics.module
--- modules/google_analytics/googleanalytics.module	15 Feb 2008 19:40:51 -0000	1.14.2.33
+++ modules/google_analytics/googleanalytics.module	19 Feb 2008 20:57:40 -0000
@@ -25,7 +25,7 @@
       'title' => t('Google Analytics'),
       'description' => t('Configure the settings used to generate your Google Analytics tracking code.'),
       'callback' => 'drupal_get_form',
-      'callback arguments' => 'googleanalytics_admin_settings',
+      'callback arguments' => 'googleanalytics_admin_settings_form',
       'access' => user_access('administer site configuration'),
       'type' => MENU_NORMAL_ITEM,
     );
@@ -165,7 +165,7 @@
 /**
  * Implementation of hook_admin_settings() for configuring the module
  */
-function googleanalytics_admin_settings() {
+function googleanalytics_admin_settings_form() {
   $form['account'] = array(
     '#type' => 'fieldset',
     '#title' => t('Analytics Account Settings'),
@@ -174,12 +174,12 @@
 
   $form['account']['googleanalytics_account'] = array(
     '#type' => 'textfield',
-    '#title' => t('User ID'),
+    '#title' => t('Google Analytics account number'),
     '#default_value' => variable_get('googleanalytics_account', 'UA-'),
     '#size' => 15,
     '#maxlength' => 20,
     '#required' => TRUE,
-    '#description' => t('The user account is unique to the websites domain. You can obtain a user account from the <a href="@url">Google Analytics</a> website.', array('@url' => 'http://www.google.com/analytics/'))
+    '#description' => t('The user account number (UA-xxxxxx-x) is unique to the websites domain. You can obtain a user account from the <a href="@url">Google Analytics</a> website.', array('@url' => 'http://www.google.com/analytics/'))
   );
 
   $form['account']['googleanalytics_legacy_version'] = array(
@@ -302,6 +302,12 @@
   return system_settings_form($form);
 }
 
+function googleanalytics_admin_settings_form_validate($form_id, $form_values) {
+  if (!preg_match('/^UA-\d{4,}-\d+$/', $form_values['googleanalytics_account'])) {
+    form_set_error('googleanalytics_account', t('A valid Google Analytics account number is case sensitive and formated like UA-xxxxxx-x.'));
+  }
+}
+
 /**
  * Implementation of hook_requirements().
  */
@@ -310,7 +316,7 @@
 
   if ($phase == 'runtime') {
     // Raise warning if Google user account has not been set yet.
-    if (variable_get('googleanalytics_account', 'UA-') == 'UA-') {
+    if (!preg_match('/^UA-\d{4,}-\d+$/', variable_get('googleanalytics_account', 'UA-'))) {
       $requirements['googleanalytics'] = array(
         'title' => t('Google Analytics module'),
         'description' => t('Google Analytics module has not been configured yet. Please configure its settings from the <a href="@url">Google Analytics settings page</a>.', array('@url' => url('admin/settings/googleanalytics'))),
