Has anyone had success passing drupal user variables (such as profile fields or user role) to a custom Disqus theme?
Disqus lists their comment variables but i don't see how they correspond to what's being passed to Disqus in the code below (lines 118 to 138 of disqus.module)
// Inject the user data if it's available.
if ($user->uid > 0) {
$data['id'] = $user->uid;
$data['username'] = $user->name;
$data['email'] = $user->mail;
$data['url'] = url('user/' . $user->uid, array(
'absolute' => TRUE,
));
// Load the user's avatar.
$user_picture_default = variable_get('user_picture_default', '');
if (isset($user->picture) && !empty($user->picture) && is_numeric($user->picture) && $file = file_load($user->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']);
}
}
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 1537548-7-disqus-user_sso_data_alter.patch | 1.17 KB | Grayside |
| #2 | user-data-alter.patch | 376 bytes | owen barton |
Comments
Comment #1
kevinwalsh commentedComment #2
owen barton commentedLooked into this, and it seems like only the existing fields are supported by Disqus SSO. Instead we are going to alter the username (display name in Disqus) instead to add user profile data (location etc) as part of the displayed name.
Attached patch adds an alter hook to allow this without hacking disqus.module.
Comment #3
marcingy commentedNeeds a re-roll but makes sense
Comment #4
Grayside commentedIf need to change the display name, running this through https://api.drupal.org/api/drupal/includes%21common.inc/function/format_... would allow hook_username_alter() to be used.
Comment #5
Grayside commented#2 worked with git apply just fine for me. Rather than take the approach I mentioned in #4, I used this hook to swap in the value added by the Realname module to the user object.
Comment #6
slashrsm commentedLooks ok. Would be nice to have api.php entry for this.
Comment #7
Grayside commentedReroll with a disqus.api.php file demonstrating realname integration via the new hook.
Comment #8
slashrsm commentedCommited. Thanks.
http://drupalcode.org/project/disqus.git/commit/183f5c8
Comment #9
Grayside commentedStatus misfire? :P