--- bio.module-orig	2007-07-03 11:28:09.000000000 -0700
+++ bio.module	2007-10-26 11:08:02.000000000 -0700
@@ -28,6 +28,19 @@ function bio_menu($may_cache) {
     );
   }
   else {
+    // Enforce creation of Bio Node
+    if (variable_get('bio_profile_required', 0)) {
+      if ($user->uid > 1 && strcmp('logout', $_GET['q'])) {
+        if (strcmp('user/' . $user->uid . '/bio', $_GET['q'])) {
+          if (!bio_for_user($user->uid)) {
+            $biotypename = node_get_types('name', variable_get('bio_nodetype','bio'));
+            drupal_set_message(t('Please create a %bio before continuing.', array('%bio' => $biotypename)), 'error');
+            drupal_goto('user/' . $user->uid . '/bio'); 
+          }
+        }
+      }
+    }
+    
     if (variable_get('bio_profile', 0) && (arg(0) == 'user') && (is_numeric(arg(1)))) {
       $type = variable_get('bio_nodetype','bio');
       $nid  = bio_for_user(arg(1));
@@ -115,27 +128,6 @@ function bio_node_info() {
 }
 
 /** 
- * Implementation of hook_nodeapi()
- * 
- * - validate biography node form to make sure that the user doesn't already
- * have one
- */
-function bio_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) { 
-  if ($node->type != variable_get('bio_nodetype', 'bio')) return;
-
-  switch ($op) {
-    case 'validate':
-      // This user already has a bio node and this isn't it
-      $account = user_load(array('name' => $node->name));
-      $nid = bio_for_user($account->uid);
-      if ($nid && ($nid != $node->nid)) {
-        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;
-  }
-}
-
-/** 
  * Implentation hook_user()
  * 
  * - add bio to main user profile page
@@ -222,6 +214,12 @@ function bio_settings() {
     '#description' => t('Display nothing but the bio node on the user profile page.'),
     '#default_value' => variable_get('bio_profile_takeover', 0),
   );
+  $form['bio_profile_required'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Required'),
+    '#description' => t('Enforce the creation of a Bio node before using the rest of the site.'),
+    '#default_value' => variable_get('bio_profile_required', 0),
+  );
   $add_a_submit = system_settings_form($form);
   $add_a_submit['#validate']['bio_settings_validate_xxx'] = array();
   return $add_a_submit;
@@ -234,7 +232,9 @@ function bio_settings() {
  * validate phase because submits were interfering with the #base attribute. Yuck.
  */
 function bio_settings_validate_xxx($form_id, $form_values) {
-  views_invalidate_cache();
+  if (module_exists('views')) {
+    views_invalidate_cache();
+  }
 }
 
 /**
