? 574084_bakery_page_caching.patch
? 574084_bakery_page_caching_39.patch
? blender
Index: bakery.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bakery/bakery.module,v
retrieving revision 1.52.2.9
diff -u -p -r1.52.2.9 bakery.module
--- bakery.module	19 Oct 2010 21:42:30 -0000	1.52.2.9
+++ bakery.module	19 Oct 2010 22:58:23 -0000
@@ -166,9 +166,9 @@ function bakery_user($op, &$array, &$acc
 }
 
 /**
- * Implementation of hook_init().
+ * Implementation of hook_boot().
  */
-function bakery_init() {
+function bakery_boot() {
   _bakery_taste_chocolatechip_cookie();
 }
 
@@ -677,6 +677,8 @@ function _bakery_taste_chocolatechip_coo
     _bakery_bake_chocolatechip_cookie($cookie['name'], $cookie['mail'], $cookie['init']);
 
     if (!$user->uid) {
+      drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
+      drupal_set_message('bootstrapper');
       $account = user_load(array('name' => $cookie['name'], 'mail' => $cookie['mail']));
 
       // Fix out of sync users with valid init.
@@ -748,6 +750,15 @@ function _bakery_taste_chocolatechip_coo
 
       if ($account && $user->uid == 0) {
         bakery_user_external_login($account);
+        if (isset($_REQUEST['destination'])) {
+          $destination = $_REQUEST['destination'];
+        }
+        else {
+          // Use $_GET here to retrieve the original path in source form.
+          $destination = isset($_GET['q']) ? $_GET['q'] : '';
+          $query = drupal_query_string_encode($_GET, array('q'));
+        }
+        drupal_goto($destination, $query);
       }
     }
 
