function disqus_sso_user_data in Disqus 7
Assembles user-specific data used by Disqus SSO.
Parameters
object|null $account:
Return value
array
1 call to disqus_sso_user_data()
- disqus_sso_disqus_settings in ./
disqus.module - Computes the full settings associated with Disqus SSO.
File
- ./
disqus.module, line 976 - The Disqus Drupal module.
Code
function disqus_sso_user_data($account = NULL) {
if (!isset($account)) {
global $user;
$account = $user;
}
$data = array();
if ($account->uid > 0) {
$data['id'] = $account->uid;
$data['username'] = $account->name;
$data['email'] = $account->mail;
$data['url'] = url('user/' . $account->uid, array(
'absolute' => TRUE,
));
// Load the user's avatar.
$user_picture_default = variable_get('user_picture_default', '');
if (isset($account->picture) && !empty($account->picture) && is_numeric($account->picture) && ($file = file_load($account->picture))) {
$data['avatar'] = !empty($file->uri) ? $file->uri : NULL;
}
elseif (!empty($user_picture_default)) {
$data['avatar'] = variable_get('user_picture_default', '');
}
if (isset($data['avatar'])) {
$data['avatar'] = file_create_url($data['avatar']);
}
}
drupal_alter('disqus_user_data', $data);
return $data;
}