Index: bio.module =================================================================== RCS file: /var/lib/cvs_web_solutions/w2/sites/all/modules/bio/bio.module,v retrieving revision 1.1 retrieving revision 1.2 diff -u -p -r1.1 -r1.2 --- bio.module 25 Jul 2007 21:33:43 -0000 1.1 +++ bio.module 25 Jul 2007 21:43:03 -0000 1.2 @@ -1,15 +1,37 @@ uid > 1) { + $type = variable_get('bio_nodetype', 'bio'); + $sql = "SELECT COUNT(n.nid) + FROM node n + WHERE n.status = 1 AND n.uid = $user->uid AND n.type = '"; + $sql .= $type; + $sql .= "'"; + + $result = db_result(db_query($sql)); + if (!$result) { + drupal_set_message('Please create a bio before continuing.', 'error'); + drupal_goto('node/add/' . $nodetype, NULL, NULL, 303); + } + } + } + } } /** @@ -188,6 +210,7 @@ function bio_for_user($uid = NULL){ * - bio node type * - node types on which to display links * - use bio for profile + * - enforce bio creation */ function bio_settings() { $types = array(); @@ -221,5 +244,11 @@ 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_enforce'] = array( + '#type' => 'checkbox', + '#title' => t('Enforce bio.'), + '#description' => t('Require every user to create a bio. If they have not, redirect them.'), + '#default_value' => variable_get('bio_enforce', 0), + ); return system_settings_form($form); }