--- profile.module.old	2006-01-26 15:43:04.000000000 +0200
+++ profile.module	2006-02-03 16:37:09.000000000 +0200
@@ -27,4 +27,5 @@
 <li>multi-line textfield</li>
 <li>checkbox</li>
+<li>checkbox group</li>
 <li>list selection</li>
 <li>freeform list</li>
@@ -156,5 +157,5 @@
     // Compile a list of fields to show
     $fields = array();
-    $result = db_query('SELECT name, title, type, weight FROM {profile_fields} WHERE fid != %d AND visibility = %d ORDER BY weight', $field->fid, PROFILE_PUBLIC_LISTINGS);
+    $result = db_query('SELECT name, title, type, weight FROM {profile_fields} WHERE fid != %d AND visibility = %d ORDER BY category, weight', $field->fid, PROFILE_PUBLIC_LISTINGS);
     while ($record = db_fetch_object($result)) {
       $fields[] = $record;
@@ -175,5 +176,8 @@
         $arguments[] = $value;
         break;
-      default:
+      case 'checkboxes':
+        $query = "v.value LIKE '%%". db_escape_string($value) ."%%'";
+        break;
+       default:
         drupal_not_found();
         return;
@@ -191,5 +195,5 @@
     $output .= theme('pager', NULL, 20);
 
-    if ($field->type == 'selection' || $field->type == 'list') {
+    if ($field->type == 'selection' || $field->type == 'list' || $field->type == 'checkboxes') {
       $title = strtr($field->page, array('%value' => theme('placeholder', $value)));
     }
@@ -272,4 +276,12 @@
       case 'checkbox':
         return $browse ? l($field->title, 'profile/'. $field->name) : check_plain($field->title);
+      case 'checkboxes':
+        foreach ($value as $val) {
+          if ($val = trim($val)) {
+            $fields[] = $browse ? l($val, "profile/". urlencode($field->name) ."/". urlencode($val)) : check_plain($val);
+          }
+        }
+        if($fields){ return implode(', ', $fields); }
+        else { return; }
       case 'url':
         return '<a href="'. check_url($value) .'">'. check_plain($value) .'</a>';
@@ -369,4 +381,15 @@
         $fields[$category][$field->name] = array('#type' => 'checkbox', '#title' => check_plain($field->title), '#default_value' => $edit[$field->name], '#description' => _profile_form_explanation($field), '#required' => $field->required);
         break;
+      case 'checkboxes':
+        $options = array();
+        $values = array();
+        $lines = split("[,\n\r]", $field->options);
+        foreach ($lines as $line) {
+          if ($line = trim($line)) {
+            $options[$line] = $line;
+          }
+        }
+        $fields[$category][$field->name] = array('#type' => 'checkboxes', '#title' => check_plain($field->title), '#default_value' => $edit[$field->name], '#options' => $options, '#description' => _profile_form_explanation($field), '#required' => $field->required);
+        break;
       case 'selection':
         $options = array('--');
@@ -587,6 +610,5 @@
     '#title' => t('Form name'),
     '#default_value' => $edit['name'],
-    '#description' => t('The name of the field. The form name is not shown to the user but used internally in the HTML code and URLs.
-Unless you know what you are doing, it is highly recommended that you prefix the form name with <code>profile_</code> to avoid name clashes with other fields. Spaces or any other special characters except dash (-) and underscore (_) are not allowed. An example name is "profile_favorite_color" or perhaps just "profile_color".'),
+    '#description' => t('The name of the field. The form name is not shown to the user but used internally in the HTML code and URLs.  Unless you know what you are doing, it is highly recommended that you prefix the form name with <code>profile_</code> to avoid name clashes with other fields. Spaces or any other special characters except dash (-) and underscore (_) are not allowed. An example name is "profile_favorite_color" or perhaps just "profile_color".'),
     '#required' => TRUE,
   );
@@ -603,4 +625,11 @@
     );
   }
+  if ($type == 'checkboxes') {
+    $form['fields']['options'] = array('#type' => 'textarea',
+      '#title' => t('Checkboxes'),
+      '#default_value' => $edit['options'],
+      '#description' => t('A list of all checkboxes. Put each option on a separate line. Example options are "red", "blue", "green", etc.'),
+    );
+  }
   $form['fields']['weight'] = array('#type' => 'weight',
     '#title' => t('Weight'),
@@ -704,4 +733,5 @@
                  'textarea' => t('multi-line textfield'),
                  'checkbox' => t('checkbox'),
+                 'checkboxes' => t('checkboxes'),
                  'selection' => t('list selection'),
                  'list' => t('freeform list'),
@@ -712,4 +742,4 @@
 
 function _profile_field_serialize($type = NULL) {
-  return $type == 'date';
+  return $type == 'date' || $type='checkboxes';
 }
