Index: planet.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/planet/planet.module,v
retrieving revision 1.7
diff -u -p -r1.7 planet.module
--- planet.module	11 Mar 2009 23:15:34 -0000	1.7
+++ planet.module	22 Mar 2009 01:59:09 -0000
@@ -172,9 +172,6 @@ if ($_POST) {  
         drupal_set_message('Edited "'. $edit['title'] .'" feed.');      
       }
       else {
-        if ($edit['planet_author_roles']) {            
-          variable_set('planet_author_roles', $edit['planet_author_roles']);
-        }
 	if ($edit['planet_filter_formats']) {
 	  variable_set('planet_filter_formats', $edit['planet_filter_formats']);
 	}
@@ -243,12 +240,16 @@ function _planet_settings() {
     }
     else {    
       if (isset($edit['fid']) && intval($edit['fid']) == 0) {
+        // Username can change, so we need to store the ID, not the username.
+        $edit['uid'] = db_result(db_query("SELECT uid from {users} WHERE name = '%s'", $edit['username']));
         db_query('INSERT INTO {planet_feeds} (uid, title, link, image, checked, frozen) VALUES(%d, "%s", "%s", "%s", 0, 0)', $edit['uid'], $edit['title'], $edit['link'], $edit['image']);
         $edit_r = db_fetch_array(db_query('SELECT fid FROM {planet_feeds} WHERE uid = %d AND title = "%s" AND link = "%s"', $edit['uid'], $edit['title'], $edit['link']));
         $title = planet_refresh(intval($edit_r['fid']));
         drupal_set_message('Added new feed: ' . $title);    
       }
       else if ($edit['fid'] && intval($edit['fid']) > 0) {            
+        // Username can change, so we need to store the ID, not the username.
+        $edit['uid'] = db_result(db_query("SELECT uid from {users} WHERE name = '%s'", $edit['username']));
         db_query('UPDATE {planet_feeds} SET uid = %d, title="%s", link = "%s", image="%s" WHERE fid=%d', $edit['uid'], $edit['title'], $edit['link'], $edit['image'], $edit['fid']);
         drupal_set_message('Edited "'. $edit['title'] .'" feed.');      
       }
@@ -349,14 +350,6 @@ function planet_multiple_delete_confirm_
 
 
 function planet_settings_form(&$form_state) {
-  $roles = array();
-
-  $result = db_query('SELECT rid, name FROM {role}');
-  while ($role = db_fetch_object($result)) {
-    $roles[$role->rid] = $role->name;
-  }
-  
-  unset($result);
   $result = db_query('SELECT format, name FROM {filter_formats}');
   while ($format = db_fetch_object($result)) {
     $formats[$format->format] = $format->name;
@@ -369,14 +362,6 @@ function planet_settings_form(&$form_sta
     '#title' => t('General Settings')
   );
   
-  $form['general']['planet_author_roles'] = array(
-    '#type' => 'select',
-    '#title' => t('Role to select authors from'),
-    '#options' => $roles,
-    '#default_value' => variable_get('planet_author_roles', 2),
-    '#description' => t('Select the role from which blog authors should be selected on the feed creation screen.')
-  );
-  
   $form['general']['planet_filter_formats'] = array(
     '#type' => 'select',
     '#title' => t('Filter format for planet entry nodes'),
@@ -410,9 +395,9 @@ function planet_feed_form(&$form_state, 
   }    
   
   if ($individual) {
-    if (!isset($uids[$edit['uid']])) {
+    if (!isset($uids[$edit['username']])) {
       $g_user = db_fetch_array(db_query('SELECT uid, name FROM {users} WHERE uid = %d', $edit['uid']));
-      $uids[$edit['uid']] = $g_user['name'];
+      $uids[$edit['username']] = $g_user['name'];
     }
   }
   
@@ -437,11 +422,13 @@ function planet_feed_form(&$form_state, 
   );
 
   if ($user == NULL) {
-    $form['feeds']['uid'] = array(
-      '#type' => 'select',
+    $form['feeds']['username'] = array(
+      '#type' => 'textfield',
       '#title' => t('Original author'),    
-      '#value' => $edit['uid'],
-      '#options' => $uids,
+      '#size' => 40,
+      '#maxlength' => 60,
+      '#default_value' => $g_user['name'],
+      '#autocomplete_path' => 'user/autocomplete,
       '#description' => t('Select a user to associate this feed with')
     );
   }
