? bakery--574160-10.patch
? bakery--650468-6-d7.patch
? bakery--709420-11.patch
? bakery--hook_menu_alter.patch
Index: bakery.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bakery/bakery.module,v
retrieving revision 1.57
diff -u -p -r1.57 bakery.module
--- bakery.module	29 Apr 2010 23:51:54 -0000	1.57
+++ bakery.module	27 Jun 2010 22:31:57 -0000
@@ -315,6 +315,13 @@ function bakery_settings($form, &$form_s
     '#options' => $options,
     '#description' => t('Chose the profile fields that should be exported by the master and imported on the slaves. Username and E-mail are always exported. The correct export of individual fields may depend on the appropriate settings for other modules on both master and slaves. You need to configure this setting on both the master and the slaves.'),
   );
+  
+  $form['bakery_username_case'] = array(
+    '#type' => 'checkbox',
+    '#title' => 'Usernames are case sensitive',
+    '#default_value' => variable_get('bakery_username_case', FALSE),
+    '#description' => t('This setting should only be selected on advanced installations where the collation of the user table has been changed (such as drupal.org). Standard Drupal installations should leave this unselected.'),
+  );
 
   // Tell system_settings_form() to not set default_values since we have already done so.
   return system_settings_form($form, FALSE);
@@ -457,17 +464,24 @@ function _bakery_taste_chocolatechip_coo
         if ($mail_count > 0) {
           $checks = FALSE;
         }
-        $name_count = db_select('users', 'u')->fields('u', array('uid'))
-          ->condition('uid', $user->uid, '!=')
-          ->where('LOWER(name) = LOWER(:name)', array(':name' => $cookie['name']))
-          ->countQuery()->execute()->fetchField();
+        if (variable_get('bakery_username_case', FALSE)) {
+          $name_count = db_select('users', 'u')->fields('u', array('uid'))
+            ->condition('uid', $user->uid, '!=')
+            ->where('name = :name', array(':name' => $cookie['name']))
+            ->countQuery()->execute()->fetchField();
+        }
+        else {
+          $name_count = db_select('users', 'u')->fields('u', array('uid'))
+            ->condition('uid', $user->uid, '!=')
+            ->where('LOWER(name) = LOWER(:name)', array(':name' => $cookie['name']))
+            ->countQuery()->execute()->fetchField();
+        }
         if ($name_count > 0) {
           $checks = FALSE;
         }
         $init_count = db_select('users', 'u')->fields('u', array('uid'))
           ->condition('uid', $user->uid, '!=')
           ->condition('init', $cookie['init'], '=')
-          ->where('LOWER(name) = LOWER(:name)', array(':name' => $cookie['name']))
           ->countQuery()->execute()->fetchField();
         if ($init_count > 0) {
           $checks = FALSE;
@@ -817,11 +831,19 @@ function bakery_uncrumble($form, &$form_
     ->where("LOWER(u.mail) = LOWER(:mail)", array(':mail' => $cookie['mail']));
   $result = $query->execute();
   $samemail = $result->fetchObject();
-    
-  $query = db_select('users', 'u')
-    ->fields('u', array('uid', 'name', 'mail'))
-    ->condition('u.uid', 0, '!=')
-    ->where("LOWER(u.name) = LOWER(:name)", array(':name' => $cookie['name']));
+  
+  if (variable_get('bakery_username_case', FALSE)) {
+    $query = db_select('users', 'u')
+      ->fields('u', array('uid', 'name', 'mail'))
+      ->condition('u.uid', 0, '!=')
+      ->where("u.name = :name", array(':name' => $cookie['name']));
+  }
+  else {
+    $query = db_select('users', 'u')
+      ->fields('u', array('uid', 'name', 'mail'))
+      ->condition('u.uid', 0, '!=')
+      ->where("LOWER(u.name) = LOWER(:name)", array(':name' => $cookie['name']));
+  }
   $result = $query->execute();
   $samename = $result->fetchObject();
 
