function openid_user_identities

Menu callback; Manage OpenID identities for the specified user.

1 string reference to 'openid_user_identities'
openid_menu in drupal/core/modules/openid/openid.module
Implements hook_menu().

File

drupal/core/modules/openid/openid.pages.inc, line 29
User page callbacks for the openid module.

Code

function openid_user_identities($account) {
  drupal_set_title(user_format_name($account));
  drupal_add_css(drupal_get_path('module', 'openid') . '/openid.css');

  // Check to see if we got a response
  $response = openid_complete();
  if ($response['status'] == 'success') {
    $identity = $response['openid.claimed_id'];
    $query = db_insert('authmap')
      ->fields(array(
      'uid' => $account->uid,
      'authname' => $identity,
      'module' => 'openid',
    ))
      ->execute();
    drupal_set_message(t('Successfully added %identity', array(
      '%identity' => $identity,
    )));

    // Let other modules act on OpenID authentication.
    module_invoke_all('openid_response', $response, $account);
  }
  $header = array(
    t('OpenID'),
    t('Operations'),
  );
  $rows = array();
  $result = db_query("SELECT * FROM {authmap} WHERE module='openid' AND uid=:uid", array(
    ':uid' => $account->uid,
  ));
  foreach ($result as $identity) {
    $row = array();
    $row[] = check_plain($identity->authname);
    $links = array();
    $links['delete'] = array(
      'title' => t('Delete'),
      'href' => 'user/' . $account->uid . '/openid/delete/' . $identity->aid,
    );
    $row[] = array(
      'data' => array(
        '#type' => 'operations',
        '#links' => $links,
      ),
    );
    $rows[] = $row;
  }
  $build['openid_table'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#empty' => t('No OpenID identities available for this account.'),
  );
  $build['openid_user_add'] = drupal_get_form('openid_user_add');
  return $build;
}