--- globalnode.module.cvs	2007-04-30 18:22:11.000000000 +0100
+++ globalnode.module	2007-04-30 18:13:27.000000000 +0100
@@ -27,7 +27,7 @@
   }
 
   return $output;
-} 
+}
 
 function globalnode_menu($may_cache){
     $items[] = array(
@@ -42,22 +42,21 @@
 }
 
 function globalnode_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL){
-  if(!is_object($GLOBALS['globalnode'])){
+  if(!is_object($GLOBALS['globalnode']) && $op == 'view'){
     $attributes = variable_get('globalnode_attributes', '');
-    $attributes = str_replace(', ', "\n", $attributes);
-    $attributes = str_replace(',', "\n", $attributes);
-    $attributes = str_replace(';', "\n", $attributes);
-    $attributes = array_unique(split("\r\n", $attributes));
-
-    $GLOBALS['globalnode'] = new stdClass();
-    switch($op){
-      case 'load':
-        foreach($attributes as $att){
-          if($node->$att){
-            $GLOBALS['globalnode']->$att = $node->$att;
-          }
+
+    if($attributes) {
+      $attributes = str_replace(', ', "\n", $attributes);
+      $attributes = str_replace(',', "\n", $attributes);
+      $attributes = str_replace(';', "\n", $attributes);
+      $attributes = array_unique(split("\r\n", $attributes));
+
+      $GLOBALS['globalnode'] = new stdClass();
+      foreach($attributes as $att){
+        if($att && $node->$att){
+          $GLOBALS['globalnode']->$att = $node->$att;
         }
-        break;
+      }
     }
   }
 }
