--- og_galleries.module	2007-12-27 02:41:34.000000000 +0100
+++ og_galleries.module.context_bug	2007-12-27 02:52:52.000000000 +0100
@@ -130,7 +138,7 @@ function og_galleries_menu($may_cache) {
         if (arg(0) == 'node' && is_numeric(arg(1)) && arg(1) == $gid) {
 
           $group = node_load($gid);
-          og_galleries_set_group_context($group);
+          og_set_group_context($group);
 
           $items[] = array(
             'path' => og_galleries_get_admin_path($gid), 'title' => t('Galleries'),
@@ -686,7 +693,7 @@ function og_galleries_set_types($types =
  *  Return the group id, or 0 if public
  */
 function og_galleries_get_gid() {
-  if ($group_node = og_galleries_get_group_context()) {
+  if ($group_node = og_get_group_context()) {
     $gid = $group_node->nid;
   }
   else {
@@ -887,29 +894,6 @@ function og_galleries_setup($form_values
 }
 
 /**
- * API function for getting the group context (if any) for the current request.
- *
- * @return $node object
- */
-function og_galleries_get_group_context() {
-  return og_galleries_set_group_context();
-}
-
-/**
- * API function for setting the group context (if any) for the current request.
- *
- * @return $node object
- */
- function og_galleries_set_group_context($group_node = NULL) {
-  static $stored_group_node;
-
-  if (!is_null($group_node)) {
-    $stored_group_node = $group_node;
-  }
-  return $stored_group_node;
-}
-
-/**
  *  Function to update OG Galleries values when the Views edit form is updated.
  */
 function og_galleries_views_update($form_id, $form_values) {
@@ -1010,7 +994,7 @@ function og_galleries_views_pre_view(&$v
     $gid = arg(sizeof($path));
     if (is_numeric($gid) && $gid != $prev_gid) {
       $group = node_load($gid);
-      og_galleries_set_group_context($group);
+      og_set_group_context($group);
       $prev_gid = $gid;
     }
     // On the view of the actual gallery item, re-build the view to display only one item on a page.
