function hybridauth_user_identity in HybridAuth Social Login 6.2
Same name and namespace in other branches
- 7.2 hybridauth.pages.inc \hybridauth_user_identity()
Menu callback; manage HybridAuth identities for the specified user.
1 string reference to 'hybridauth_user_identity'
- hybridauth_menu in ./
hybridauth.module - Implements hook_menu().
File
- ./
hybridauth.pages.inc, line 464
Code
function hybridauth_user_identity(&$form_state, $account) {
global $user;
//drupal_set_title(format_username($account));
$identities = _hybridauth_identity_load_by_uid($account->uid);
$providers = hybridauth_providers_list();
$header = array(
t('Authentication provider'),
t('Identity'),
t('Delete'),
);
$rows = array();
$data_array = array();
foreach ($identities as $identity) {
$data = unserialize($identity['data']);
$data_array[] = $data;
$rows[] = array(
$providers[$data['provider']],
l($data['profileURL'], $data['profileURL'], array(
'attributes' => array(
'target' => '_blank',
),
'external' => TRUE,
)),
l(t('Delete'), 'user/' . $account->uid . '/hybridauth/delete/' . $identity['id']),
);
}
$form = array();
$form['identity'] = array(
'#value' => theme('table', $header, $rows),
);
// Add more identities.
if ($account->uid == $user->uid && user_access('use hybridauth')) {
$form['hybridauth_widget'] = array(
'#type' => 'hybridauth_widget',
'#title' => t('Add more identities'),
'#weight' => 10,
'#hybridauth_widget_type' => 'list',
'#hybridauth_destination' => '',
);
}
$connected_providers = hybridauth_get_connected_providers();
$form['connected_providers'] = array(
'#value' => t('Currently connected to (session data):') . ' ' . implode(', ', $connected_providers),
'#weight' => 15,
);
// Tokens browser for admins.
if (user_access('administer site configuration') || user_access('administer users')) {
$header = array(
t('Token'),
t('Value'),
);
// User tokens.
if (!empty($account->hybridauth)) {
$form['fset_user_tokens'] = array(
'#type' => 'fieldset',
'#title' => t('User tokens'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => 20,
'#group' => 'fset_user_tokens',
);
$rows = array();
foreach ($account->hybridauth as $key => $value) {
$rows[] = array(
'[hybridauth_' . $key . ']',
$value,
);
}
$form['fset_user_tokens']['tokens'] = array(
'#value' => theme('table', $header, $rows),
);
}
// Data from auth providers.
foreach ($data_array as $data) {
$form['fset_' . $data['provider'] . '_' . $data['identifier']] = array(
'#type' => 'fieldset',
'#title' => $providers[$data['provider']],
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => 20,
'#group' => 'fset_' . $data['provider'] . '_' . $data['identifier'],
);
$rows = array();
foreach ($data as $key => $value) {
$rows[] = array(
$key,
$value,
);
}
$form['fset_' . $data['provider'] . '_' . $data['identifier']]['tokens'] = array(
'#value' => theme('table', $header, $rows),
);
}
}
// Add vertical tabs display if available.
$form['#pre_render'][] = 'vertical_tabs_form_pre_render';
return $form;
}