Index: cck_field_privacy.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck_field_privacy/cck_field_privacy.install,v
retrieving revision 1.2
diff -u -r1.2 cck_field_privacy.install
--- cck_field_privacy.install	12 Feb 2008 00:57:05 -0000	1.2
+++ cck_field_privacy.install	18 Feb 2008 20:39:37 -0000
@@ -20,8 +20,8 @@
       ");
       break;
   }
-  variable_set('cckfp_values', array());
-  variable_set('cckfp_types', array());
+  variable_set('cckfp_values', '');
+  variable_set('cckfp_types', '');
 }
 
 /**
Index: cck_field_privacy.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck_field_privacy/cck_field_privacy.module,v
retrieving revision 1.2
diff -u -r1.2 cck_field_privacy.module
--- cck_field_privacy.module	18 Feb 2008 20:30:59 -0000	1.2
+++ cck_field_privacy.module	18 Feb 2008 20:41:20 -0000
@@ -109,67 +109,69 @@
   
   $uid = (int) isset($form['#node']->uid)? $form['#node']->uid : $user->uid; // original author or current user (authoring new node)
   $types = variable_get('cckfp_types', null);
-  if (!array_key_exists($form['#node']->type, $types) || $types[$form['#id']] == '0') {
-    return; // abort
-  }
-
-  // Get the stored fields
-  $fields = variable_get('cckfp_types', null);
-  $values = unserialize(variable_get('cckfp_values', ''));
-
-  $cckfp_enabled_fields = array();
-
-  // Figure out what node type (via name) we are accessing.
-  $node_name_array = explode('_', $form_id);
-  if (array_key_exists($node_name_array[0], $fields)) {
-    if ($fields[$node_name_array[0]] != '0') {
-      foreach ($values as $name => $value) {
-        if ($name == $node_name_array[0]) {
-          foreach ($value as $field => $enabled) {
-            if (!$enabled) continue;
-            if (array_key_exists($field, $form)) {
-              if (isset($form[$field][0]['value'])) {
-                $form_field =& $form[$field][0]['value'];
-              } elseif (isset($form[$field]['keys'])) {
-                $form_field =& $form[$field]['keys'];
-              } elseif (isset($form[$field]['key'])) {
-                $form_field =& $form[$field]['key'];
-              } else {
-                $form_field =& $form[$field];
+  
+  if(is_array($types)) {
+    if (!array_key_exists($form['#node']->type, $types) || $types[$form['#id']] == '0') {
+      return; // abort
+    }
+
+    // Get the stored fields
+    $fields = variable_get('cckfp_types', null);
+    $values = unserialize(variable_get('cckfp_values', ''));
+
+    $cckfp_enabled_fields = array();
+
+    // Figure out what node type (via name) we are accessing.
+    $node_name_array = explode('_', $form_id);
+    if (array_key_exists($node_name_array[0], $fields)) {
+      if ($fields[$node_name_array[0]] != '0') {
+        foreach ($values as $name => $value) {
+          if ($name == $node_name_array[0]) {
+            foreach ($value as $field => $enabled) {
+              if (!$enabled) continue;
+              if (array_key_exists($field, $form)) {
+                if (isset($form[$field][0]['value'])) {
+                  $form_field =& $form[$field][0]['value'];
+                } elseif (isset($form[$field]['keys'])) {
+                  $form_field =& $form[$field]['keys'];
+                } elseif (isset($form[$field]['key'])) {
+                  $form_field =& $form[$field]['key'];
+                } else {
+                  $form_field =& $form[$field];
+                }
+
+                // Get the current state of the field
+                $field_pref_sql = db_query("SELECT permission FROM {content_field_privacy} WHERE uid = %d AND type_name = '%s' AND field_name = '%s'", $uid, $node_name_array[0], $field);
+                $field_pref = (string) db_result($field_pref_sql);
+
+                // Let's add the field name to the array of fields
+                $cckfp_enabled_fields[$field] = $field_pref;
+
+                // Add the padlock icon & link to the JQuery function
+                // @TODO: Add this via jQuery to degrade gracefully in browsers without JavaScript enabled.
+                // @TODO: Get the padlock to also appear on field group titles (fieldset legends), if selected.
+                $form_field['#title'] .= "<a href='#' id='".$field."link' ><img src='". base_path() . drupal_get_path('module', 'cck_field_privacy'). "/padlock.png' /></a>";
               }
-
-              // Get the current state of the field
-              $field_pref_sql = db_query("SELECT permission FROM {content_field_privacy} WHERE uid = %d AND type_name = '%s' AND field_name = '%s'", $uid, $node_name_array[0], $field);
-              $field_pref = (string) db_result($field_pref_sql);
-
-              // Let's add the field name to the array of fields
-              $cckfp_enabled_fields[$field] = $field_pref;
-
-              // Add the padlock icon & link to the JQuery function
-              // @TODO: Add this via jQuery to degrade gracefully in browsers without JavaScript enabled.
-              // @TODO: Get the padlock to also appear on field group titles (fieldset legends), if selected.
-              $form_field['#title'] .= "<a href='#' id='".$field."link' ><img src='". base_path() . drupal_get_path('module', 'cck_field_privacy'). "/padlock.png' /></a>";
             }
           }
         }
       }
-    }
 
-    // include javascript and css
-    jquery_impromptu_add(); // css and js
-    drupal_add_js(drupal_get_path('module', 'cck_field_privacy') .'/cck_field_privacy.js');
-
-    // output per-page settings
-    drupal_add_js(array(
-      'cck_field_privacy' => array(
-        'action' => url('cck_field_privacy/ajax'),
-        'uid' => $uid,
-        'content_type' => $node_name_array[0],
-        'default_value' => $cckfp_enabled_fields,
-      ),
-    ), 'setting');
+      // include javascript and css
+      jquery_impromptu_add(); // css and js
+      drupal_add_js(drupal_get_path('module', 'cck_field_privacy') .'/cck_field_privacy.js');
+
+      // output per-page settings
+      drupal_add_js(array(
+        'cck_field_privacy' => array(
+          'action' => url('cck_field_privacy/ajax'),
+          'uid' => $uid,
+          'content_type' => $node_name_array[0],
+          'default_value' => $cckfp_enabled_fields,
+        ),
+      ), 'setting');
+    }
   }
-
   return $form;
 }
 

