=== modified file 'sites/all/modules/openid_provider/openid_provider.module'
--- sites/all/modules/openid_provider/openid_provider.module	2010-08-12 12:57:17 +0000
+++ sites/all/modules/openid_provider/openid_provider.module	2010-08-12 13:05:55 +0000
@@ -115,7 +115,9 @@ function openid_provider_user($op, &$edi
         if ($account->name) {
           $placeholders = pathauto_get_placeholders('user', $pathauto_user);
           $src = openid_provider_user_path($account->uid);
-          $alias = pathauto_create_alias('openid_provider', $op, $placeholders, $src, $account->uid);
+          if ($src) {
+            pathauto_create_alias('openid_provider', $op, $placeholders, $src, $account->uid);
+          }
         }
       }
       break;
@@ -123,7 +125,10 @@ function openid_provider_user($op, &$edi
       // If the user is deleted, remove the path aliases
       if (module_exists('pathauto')) {
         $account = (object) $account;
-       	path_set_alias(openid_provider_user_path($account->uid));
+        $src = openid_provider_user_path($account->uid);
+        if ($src) {
+          path_set_alias($src);
+        }
       }
       break;
     case 'view':
@@ -165,6 +170,9 @@ function openid_provider_user_path($uid)
   if (is_object($uid)) {
     $uid = $uid->uid;
   }
+  if ($uid == variable_get('openid_provider_root_user', 0) ) {
+    return '';
+  }
   return sprintf('user/%s/identity', $uid);
 }
 
@@ -181,9 +189,40 @@ function openid_provider_admin_settings(
     '#maxlength' => 10,
     '#description' => t('This timeout is necessary to ensure proper security of your identities. If an attacker sniffing the network gets a hold of the SHA1 hash and is somehow able to bruteforce it, he can perform a man in the middle attack and access the target site. Since brute force attacks take a long time, this timeout ensures this attack is impracticable. !readmore', array('!readmore' => l(t('More information about this issue.'), 'http://openid.net/pipermail/security/2007-February/000237.html'))),
   );
+
+  $rootuser = variable_get('openid_provider_root_user', '');
+  if (is_numeric($rootuser)) {
+    // Display userID as name
+    $rootuser = db_result(db_query("SELECT name FROM {users} WHERE uid=%d", $rootuser));
+  }
+  $rootpath = preg_replace('|https?://(.+)/|', '$1', openid_provider_url(''));
+  $form['openid_provider_root_user'] = array(
+    '#type' => 'textfield',
+    '#title' => t('User having site root as OpenID'),
+    '#default_value' => $rootuser,
+    '#autocomplete_path' => 'user/autocomplete',
+    '#size' => '18',
+    '#description' => t("<p>The OpenID (identity path) for users on this site is of the form %userpath. One user can use the 'site root' (%rootpath) instead.</p>
+      <p>It is usually not necessary to set this, but it's applicable for someone who is already using this 'site root' as their identity path, and is switching to this Drupal module for an identity provider.</p>",
+      array('%userpath' => openid_provider_user_path('%user'), '%rootpath' => $rootpath)),
+  );
+
+  $form['#validate'][] = 'openid_provider_admin_settings_validate';
   return system_settings_form($form);
 }
 
+function openid_provider_admin_settings_validate($form, &$form_state) {
+  if (!empty($form_state['values']['openid_provider_root_user'])) {
+    // Convert name in textbox to userID
+    if ($uid = db_result(db_query("SELECT uid FROM {users} WHERE name='%s'", $form_state['values']['openid_provider_root_user']))) {
+      $form_state['values']['openid_provider_root_user'] = $uid;
+    }
+    else {
+      form_set_error('openid_provider_root_user', 'Invalid username');
+    }
+  }
+}
+
 /**
  * Return a XRDS for this server to discover it based on the root url
  */
@@ -341,7 +380,7 @@ function openid_provider_pathauto_bulkup
   while ($user = db_fetch_object($result)) {
     $placeholders = pathauto_get_placeholders('user', $user);
     $src = openid_provider_user_path($user->uid);
-    if ($alias = pathauto_create_alias('openid_provider', 'bulkupdate', $placeholders, $src, $user->uid)) {
+    if ($src && pathauto_create_alias('openid_provider', 'bulkupdate', $placeholders, $src, $user->uid)) {
       $count++;
     }
   }

