Index: openid_cp_field.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openid_cp_field/openid_cp_field.module,v
retrieving revision 1.1.2.8
diff -u -p -r1.1.2.8 openid_cp_field.module
--- openid_cp_field.module	23 Apr 2009 14:04:52 -0000	1.1.2.8
+++ openid_cp_field.module	23 Apr 2009 14:46:58 -0000
@@ -91,18 +91,31 @@ function openid_cp_field_map($form_state
   $options_openid = array();
   $openid_attrs = _openid_cp_field_schema_definitions();
 
-  foreach ($openid_attrs as $id => $attr) {
-    if (!in_array($id, $already_mapped_openid)) {
-      $options_openid += array($id => 'AX: '. $attr['label']);
+  if (module_exists('openid_provider_ax') || module_exists('openid_client_ax')) {
+    foreach ($openid_attrs as $id => $attr) {
+      if (!in_array($id, $already_mapped_openid)) {
+        $options_openid += array($id => 'AX: '. $attr['label']);
+      }
     }
   }
 
   $openid_sreg_fields = array();
-  foreach ($openid_attrs as $id => $attr) {
-    if (isset($attr['sreg']) && !in_array($attr['sreg'], $already_mapped_sreg)) {
-      $openid_sreg_fields += array($attr['sreg'] => 'SReg: '. $attr['label']);
+  if (module_exists('openid_provider_sreg')) {
+    foreach ($openid_attrs as $id => $attr) {
+      if (isset($attr['sreg']) && !in_array($attr['sreg'], $already_mapped_sreg)) {
+        $openid_sreg_fields += array($attr['sreg'] => 'SReg: '. $attr['label']);
+      }
     }
   }
+  
+  if (!module_exists('openid_client_ax') && !module_exists('openid_provider')) {
+    $form['warning']['#value'] = t('Enable OpenID Client AX module to use this module on an OpenID client site.');
+    return $form;
+  }
+  elseif (!(module_exists('openid_provider_sreg') || module_exists('openid_provider_ax')) && !module_exists('openid_client_ax')) {
+    $form['warning']['#value'] = t('Enable OpenID Provider SReg, OpenID Provider AX or both to use the module on an OpenID provider site.');
+    return $form;
+  }
 
   // Generate table for showing the current mapping
   $rows = array();
