Index: bio/README.txt
===================================================================
RCS file: /cvs/drupal/contributions/modules/bio/README.txt,v
retrieving revision 1.2.6.2
diff -u -p -r1.2.6.2 README.txt
--- bio/README.txt	26 May 2007 00:06:47 -0000	1.2.6.2
+++ bio/README.txt	12 Jan 2008 18:30:21 -0000
@@ -9,7 +9,7 @@ The bio module is a simple custom node-t
 1) Unless a user has "administer nodes" permissions, he or she can only create *one* bio entry.
 2) Any content that a user creates will receive a link to their bio entry.
 
-The module does not use any custom fields and does not require installation of any database tables.
+The module does not use any custom fields. It installs one small database table for associating bio nodes with user ids.
 
 When configuring a site using this module, I recommend either:
 a) going to admin/build/themes/settings and disabling the "Display post information on" checkboxes
Index: bio/bio.install
===================================================================
RCS file: /cvs/drupal/contributions/modules/bio/bio.install,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 bio.install
--- bio/bio.install	20 May 2007 18:42:29 -0000	1.1.2.1
+++ bio/bio.install	12 Jan 2008 18:30:21 -0000
@@ -1,11 +1,37 @@
-<?php // $Id: bio.install,v 1.1.2.1 2007/05/20 18:42:29 jjeff Exp $
+<?php
+// $Id: bio.install,v 1.1.2.1 2007/05/20 18:42:29 jjeff Exp $
 
+/**
+ * Implementation of hook_install().
+ */
+function bio_install() {
+  switch ($GLOBALS['db_type']) {
+    case 'mysql':
+    case 'mysqli':
+      db_query("CREATE TABLE {bio} (
+        nid int unsigned NOT NULL default '0',
+        uid int unsigned NOT NULL default '0',
+        PRIMARY KEY (nid, uid),
+      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
+      break;
+    case 'pgsql':
+      db_query("CREATE TABLE {bio} (
+        nid int_unsigned NOT NULL default '0',
+        uid int_unsigned NOT NULL default '0',
+        PRIMARY KEY (nid, uid)
+      )");
+      break;
+  }
+}
+
+/**
+ * Copy per-nodetype link settings into different format.
+ */
 function bio_update_1() {
   $ret = array();
 
-  // copy per-nodetype link settings into different format
   $bio_link = array();
-  foreach(node_get_types() as $key => $type) {
+  foreach (node_get_types() as $key => $type) {
     $bio_link[$key] = variable_get('bio_'.$key, 0) ? $key : 0;
   }
   variable_set('bio_link', $bio_link);
@@ -18,3 +44,55 @@ function bio_update_1() {
 
   return $ret;
 }
+
+/*
+ * 5.x-1.x specific updates.
+ */
+
+/**
+ * Creates and populates a table to hold uid/nid combination.
+ *
+ * Workaround for node_user's annoying behaviour of anonymizing bio nodes
+ * which prevents us from deleting them. 
+ */
+function bio_update_5100() {
+  $ret = array();
+
+  // Create bio table.
+  switch ($GLOBALS['db_type']) {
+    case 'mysql':
+    case 'mysqli':
+      $ret[] = update_sql("CREATE TABLE {bio} (
+        nid int unsigned NOT NULL default '0',
+        uid int unsigned NOT NULL default '0',
+        PRIMARY KEY (nid, uid)
+      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
+      break;
+    case 'pgsql':
+      $ret[] = update_sql("CREATE TABLE {bio} (
+        nid int_unsigned NOT NULL default '0',
+        uid int_unsigned NOT NULL default '0',
+        PRIMARY KEY (nid, uid)
+      )");
+      break;
+  }
+
+  // Populate table.
+  $type = db_escape_string(variable_get('bio_nodetype', 'bio'));
+  $ret[] = update_sql("INSERT INTO {bio} SELECT nid, uid FROM {node} WHERE type = '$type' AND uid <> 0");
+
+  return $ret;
+}
+
+/**
+ * Implementation of hook_uninstall().
+ */
+function bio_uninstall() {
+  db_query('DROP TABLE {bio}');
+  variable_del('bio_nodetype');
+  variable_del('bio_link');
+  variable_del('bio_profile');
+  variable_del('bio_profile_takeover');
+  variable_del('bio_regstration_form');
+  variable_del('bio_regstration_form_fields');
+}
Index: bio/bio.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/bio/bio.module,v
retrieving revision 1.2.2.17
diff -u -p -r1.2.2.17 bio.module
--- bio/bio.module	17 Dec 2007 02:04:58 -0000	1.2.2.17
+++ bio/bio.module	12 Jan 2008 18:30:23 -0000
@@ -217,6 +217,10 @@ function bio_nodeapi(&$node, $op, $a3 = 
         form_set_error('name', t('This user already has a @bio. Edit it <a href="@link">here</a> or assign this entry to another user.', array('@bio' => node_get_types('name', $node), '@link' => url('node/'.$nid.'/edit'))));
       } 
       break;
+    case 'insert':
+      // Record user's bio in bio table.
+      db_query('INSERT INTO {bio} (nid, uid) VALUES (%d, %d)', $node->nid, $node->uid);
+
   }
 }
 
@@ -225,14 +229,18 @@ function bio_nodeapi(&$node, $op, $a3 = 
  * 
  * - add bio to main user profile page
  */
-function bio_user($op, &$edit, &$user, $category = NULL) {
+function bio_user($op, &$edit, &$account, $category = NULL) {
   if (!variable_get('bio_profile', 0)) return;
 
   switch ($op) {
     case 'view':
-      if (!$nid = bio_for_user($user->uid)) return;
+      if (!$nid = bio_for_user($account->uid)) return;
       if (!node_access('view', $node = node_load($nid))) return;
       return array(node_get_types('name', variable_get('bio_nodetype', 'bio')) => array('bio' => array('value' => node_view($node, FALSE, TRUE, FALSE))));
+      break;
+    case 'delete':
+      node_delete(bio_for_user($account->uid));
+      db_query('DELETE FROM {bio} where uid = %d', $account->uid);
   }
 }
 
@@ -260,11 +268,11 @@ function bio_link($type, $node = NULL, $
  * FALSE if user has no bio node
  */
 function bio_for_user($uid = NULL){
-  if (is_null($uid)){
+  if (is_null($uid)) {
     global $user;
     $uid = $user->uid;
   }
-  return db_result(db_query("SELECT nid FROM {node} WHERE uid = %d AND type = '%s'", $uid, variable_get('bio_nodetype', 'bio')));
+  return db_result(db_query('SELECT nid FROM {bio} WHERE uid = %d', $uid));
 }
 
 /**
