? LICENSE.txt
? openidadmin_notabs_v2.patch
Index: openidadmin.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/openidadmin/openidadmin.module,v
retrieving revision 1.1
diff -u -p -r1.1 openidadmin.module
--- openidadmin.module	22 Sep 2009 20:52:59 -0000	1.1
+++ openidadmin.module	10 Jan 2010 04:57:27 -0000
@@ -13,48 +13,6 @@
  */
 
 /**
- * Implementation of hook_menu().
- */
-function openidadmin_menu() {
-  $items = array();
-  // Move default openid tab to a subtab
-  $items['user/%user/openid/identities'] = array(
-    'title' => 'OpenID identities',
-    'type' => MENU_DEFAULT_LOCAL_TASK,
-    'weight' => -10,
-  );
-  $items['user/%user/openid/list'] = array(
-    'title' => 'Add list',
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('openidadmin_list_form',1),
-    'access callback' => 'openidadmin_list_access',
-    'access arguments' => array(1),
-    'type' => MENU_LOCAL_TASK,
-    //'file' => 'openid.pages.inc',
-    
-  );  
-
-  return $items;
-}
-
-/**
- * Menu access callback
- */
-function openidadmin_list_access($account) {
-  return user_edit_access($account) && user_access('add list of open ids');
-}
-
-/**
- * Implementation of hook_help()
- */
-function openidadmin_help($path, $arg) {
-  switch ($path) {
-    case 'user/%/openid/list':
-      return t('You may add a list op OpenID\'s for this user account. These identities will skip any authentication and will be just linked to this account.');
-  }
-}
-
-/**
  * Implementation of hook_perm()
  */
 function openidadmin_perm() {
@@ -62,26 +20,32 @@ function openidadmin_perm() {
 }
 
 /**
- * Form callback. Add list of Open IDs
+ * Implementation of hook_form_alter() for openid_user_add.
  */
-function openidadmin_list_form(&$form_state, $account) {
-  $form['account'] = array('#type' => 'value', '#value' => $account);
-  $form['list'] = array(
-    '#type' => 'textarea',
-    '#title' => t('List of OpenIDs'),
-    '#required' => TRUE,
-    '#description' => t('Add a list of OpenIDs for this account, one per line.'),
-  );
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Add'));
-  return $form;
-  
+function openidadmin_form_openid_user_add_alter(&$form, $form_state) {
+  // We may be in some different location in the menu tree. Try both loaders.
+  $account = menu_get_object('user') ? menu_get_object('user') : menu_get_object('user_category');
+  if ($account && user_edit_access($account) && user_access('add list of open ids')) {
+    $form['openid_identifier']['#access'] = FALSE;
+    $form['account'] = array('#type' => 'value', '#value' => $account);
+    $form['list'] = array(
+      '#weight' => -1,
+      '#type' => 'textarea',
+      '#title' => t('List of OpenIDs'),
+      '#required' => TRUE,
+      '#description' => t('Add a list of OpenIDs for this account, one per line.'),
+      '#element_validate' => array('openidadmin_list_form_validate'),
+    );
+    $form['submit']['#value'] = t('Add');
+    $form['submit']['#submit'] = array('openidadmin_list_form_submit');
+  }
 }
 
 /**
  * Form callback. List validation
  */
-function openidadmin_list_form_validate($form, &$form_state) {
-  foreach (openidadmin_normalize_list($form_state['values']['list']) as $claimed_id) {
+function openidadmin_list_form_validate($element, &$form_state) {
+  foreach (openidadmin_normalize_list($element['#value']) as $claimed_id) {
     // Check for existing entries.
     if ($uid = db_result(db_query("SELECT uid FROM {authmap} WHERE authname='%s'", $claimed_id))) {
       $account = user_load(array('uid' => $uid));
@@ -120,4 +84,4 @@ function openidadmin_normalize_list($tex
     }   
   }
   return $normalized;
-}
\ No newline at end of file
+}
