--- /sites/all/modules/og_forum/og_forum.module	2010-10-07 19:07:26.821471000 +0000
+++ /sites/all/modules/og_forum/og_forum.module	2010-10-07 19:11:59.047405300 +0000
@@ -474,120 +474,116 @@
     case 'insert':
       if (og_is_group_type($node->type)) { 
         $default_container_yn = variable_get('forum_default_container_yn', FALSE);
+       if (og_is_group_type($node->type)) { 
+        //Setup Main Container
+        $edit = array('name' => $node->title, 'vid' => og_forum_get_vid());
+        $default_container_yn = variable_get('forum_default_container_yn', FALSE);
         if ($default_container_yn) {
-          $edit = array('name' => $node->title, 'vid' => og_forum_get_vid());
           $default_container = variable_get('forum_default_container', 0);
           $edit['parent'] = array($default_container);
-          unset($edit['tid']);
-          $status = taxonomy_save_term($edit);
-          db_query('INSERT INTO {og_term} (tid, nid) VALUES (%d, %d)', $edit['tid'], $node->nid);
-        }
-        else {
-          //Added Functionality to allow for the creation of multiple forums/containers
-          //when a new group is created. To use, change the default forum name
-          //in OG_Forum administation to a semicolon seperated list
-          //e.g. Forum1;Forum2;Forum
-          //Use C for new container, P for the previous container, R to return to the root container
-          //e.g. Forum1;C;Container2;Forum2;C;Container3;Forum3;R;Forum4 would give the structure
-          //  Group Container
-          //  Forum1
-          //  Container2
-          //  ..Forum2
-          //  ..Container3
-          //  ....Forum3
-          //  Forum4
-          // NOTE: Weights are used to keep the ordering correct
-          // 2-19-2008 Josh Cohen
-          // Updated 3-13-2008 - Added ability to use descriptions. Follow the container or 
-          // forum number by a comma, then decription. e.g. Forum3, This is a description;Forum4
-          //
-          //Setup Main Container
-          $edit = array('name' => $node->title, 'vid' => og_forum_get_vid());
-          $status = taxonomy_save_term($edit);
-          $containers = variable_get('forum_containers', array());
-          $containers[] = $edit['tid'];
-          variable_set('forum_containers', $containers);
-          db_query('INSERT INTO {og_term} (tid, nid) VALUES (%d, %d)', $edit['tid'], $node->nid);
-          ///Start Multiple Forum Code Change 
-          // 2-19-2008 Josh Cohen
-          $curr_container = $edit['tid'];
-          $root_container = $curr_container;
-          unset($edit['tid']); //taxonomy_save_term will give us new tids
-          $default_forum_names = variable_get('forum_default_name', 'General discussion');
-          $forum_names = explode(";",$default_forum_names); //return default forum names as an array
-          $is_container = 0;
-          $c_order = array($root_container); //To keep track of the container sequence
-          $weight_indx = -10;
-          foreach ($forum_names as $fvalue){
-            switch(strtoupper($fvalue)){
-            case('C'): //Create New Container
-              $is_container = 1;
-              break;
-            case('P'): //Go to previous container
-              //Delete current container
-              if (end($c_order) != $root_container){
-                array_pop($c_order);
-              }
-              //Set current container
-              $curr_container = end($c_order);
-              $is_container = 0;
-              break;
-            case('R'): //Go to the root container
-              unset($c_order);
-              $c_order = array($root_container);
-              $curr_container = $root_container;
-              $is_container = 0;
-              break;
-            default:
-              if ($is_container == '1'){
-                //Add New Container
-                $forum_names = explode(",",$fvalue); //Break out Name and Description
-                if (count($forum_names) == 2){
-                  $fname = $forum_names[0];
-                  $fdesc = $forum_names[1];
-                }else{
-                  $fname = $forum_names[0];
-                  unset($fdesc);
-                }                
-                $edit = array('name' => $fname, 'vid' => og_forum_get_vid(), 'parent' => $curr_container, 'weight' => $weight_indx, 'description' => $fdesc);
-                $status = taxonomy_save_term($edit);
-                $containers = variable_get('forum_containers', array());
-                $containers[] = $edit['tid'];
-                variable_set('forum_containers', $containers);
-                $curr_container = $edit['tid'];
-                $c_order[] = $edit['tid']; //Add the new container to our index
-                unset($edit['tid']);
-                unset($edit['parent']);
-                $is_container = 0;                
-                $weight_indx = $weight_indx + 1;                
-              }
-              else {
-               //Add New Forum
-               $forum_names = explode(",",$fvalue); //Break out Name and Description
-                if (count($forum_names) == 2){
-                  $fname = $forum_names[0];
-                  $fdesc = $forum_names[1];
-                }else{
-                  $fname = $forum_names[0];
-                  unset($fdesc);
-                }       
-               $edit['name'] = $fname;
-               $edit['description'] = $fdesc;
-               $edit['parent'] = $curr_container;
-               $edit['weight'] = $weight_indx;               
-               $status = taxonomy_save_term($edit);
-               unset($edit['tid']); //Clear term so Taxonomy_save_term will generate a new term on next iteration
-               $is_container = 0;
-               $weight_indx = $weight_indx + 1;
-              }
-              break;
-            } //End Switch
-          }            
-          unset($forum_names); //clean up variables
-          unset($c_order);
-          //End Multiple Forum Code Change 
-          //2-19-2008 Josh Cohen         
         }
+        $status = taxonomy_save_term($edit);
+        $containers = variable_get('forum_containers', array());
+        $containers[] = $edit['tid'];
+        variable_set('forum_containers', $containers);
+        db_query('INSERT INTO {og_term} (tid, nid) VALUES (%d, %d)', $edit['tid'], $node->nid);
+        //Added Functionality to allow for the creation of multiple forums/containers
+        //when a new group is created. To use, change the default forum name
+        //in OG_Forum administation to a semicolon seperated list
+        //e.g. Forum1;Forum2;Forum
+        //Use C for new container, P for the previous container, R to return to the root container
+        //e.g. Forum1;C;Container2;Forum2;C;Container3;Forum3;R;Forum4 would give the structure
+        //  Group Container
+        //  Forum1
+        //  Container2
+        //  ..Forum2
+        //  ..Container3
+        //  ....Forum3
+        //  Forum4
+        // NOTE: Weights are used to keep the ordering correct
+        // 2-19-2008 Josh Cohen
+        // Updated 3-13-2008 - Added ability to use descriptions. Follow the container or 
+        // forum number by a comma, then decription. e.g. Forum3, This is a description;Forum4
+        //
+        ///Start Multiple Forum Code Change 
+        // 2-19-2008 Josh Cohen
+        $curr_container = $edit['tid'];
+        $root_container = $curr_container;
+        unset($edit['tid']); //taxonomy_save_term will give us new tids
+        $default_forum_names = variable_get('forum_default_name', 'General discussion');
+        $forum_names = explode(";",$default_forum_names); //return default forum names as an array
+        $is_container = 0;
+        $c_order = array($root_container); //To keep track of the container sequence
+        $weight_indx = -10;
+        foreach ($forum_names as $fvalue){
+          switch(strtoupper($fvalue)){
+          case('C'): //Create New Container
+            $is_container = 1;
+            break;
+          case('P'): //Go to previous container
+            //Delete current container
+            if (end($c_order) != $root_container){
+              array_pop($c_order);
+            }
+            //Set current container
+            $curr_container = end($c_order);
+            $is_container = 0;
+            break;
+          case('R'): //Go to the root container
+            unset($c_order);
+            $c_order = array($root_container);
+            $curr_container = $root_container;
+            $is_container = 0;
+            break;
+          default:
+            if ($is_container == '1'){
+              //Add New Container
+              $forum_names = explode(",",$fvalue); //Break out Name and Description
+              if (count($forum_names) == 2){
+                $fname = $forum_names[0];
+                $fdesc = $forum_names[1];
+              }else{
+                $fname = $forum_names[0];
+                unset($fdesc);
+              }                
+              $edit = array('name' => $fname, 'vid' => og_forum_get_vid(), 'parent' => $curr_container, 'weight' => $weight_indx, 'description' => $fdesc);
+              $status = taxonomy_save_term($edit);
+              $containers = variable_get('forum_containers', array());
+              $containers[] = $edit['tid'];
+              variable_set('forum_containers', $containers);
+              $curr_container = $edit['tid'];
+              $c_order[] = $edit['tid']; //Add the new container to our index
+              unset($edit['tid']);
+              unset($edit['parent']);
+              $is_container = 0;                
+              $weight_indx = $weight_indx + 1;                
+            }
+            else {
+             //Add New Forum
+             $forum_names = explode(",",$fvalue); //Break out Name and Description
+              if (count($forum_names) == 2){
+                $fname = $forum_names[0];
+                $fdesc = $forum_names[1];
+              }else{
+                $fname = $forum_names[0];
+                unset($fdesc);
+              }       
+             $edit['name'] = $fname;
+             $edit['description'] = $fdesc;
+             $edit['parent'] = $curr_container;
+             $edit['weight'] = $weight_indx;               
+             $status = taxonomy_save_term($edit);
+             unset($edit['tid']); //Clear term so Taxonomy_save_term will generate a new term on next iteration
+             $is_container = 0;
+             $weight_indx = $weight_indx + 1;
+            }
+            break;
+          } //End Switch
+        }            
+        unset($forum_names); //clean up variables
+        unset($c_order);
+        //End Multiple Forum Code Change 
+        //2-19-2008 Josh Cohen
       }
       elseif ($node->type == 'forum') {//if the node is marked public, check the 'puclicity' settings and act accordingly
         //setup variables for common operations
