Jump to:
| Project: | Gigya - Social optimization |
| Version: | 6.x-2.x-dev |
| Component: | Social network integration |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
I'm having problems accessing the avatars from myspace, facebook and twitter. Im using Drupal 6 and the latest cvs of gigya socialize. What I'm simply trying to accomplish is to make the User picture check to see if there is a social avatar and use that avatar. Something like this will get the string of the avatar (in this example from twitter) if it exists from the $account var:
$arr = $account->content;
$pic = $arr["user_picture"]["#value"]; // here is the user picture i'd like to replace
if isset($arr["gigya"]["twitter"]["bio"]["#value"]) {
$twitter_html = $arr["gigya"]["twitter"]["bio"]["#value"]; // can substitute facebook and MySpace here
$twit = strstr($twitter_html, "http"); // returns everything starting from http
$twitt = strstr($twit, '"'); // returns everything after the ending " (also removes the ")
$twitter_pic = str_replace($twitt, "", $twit); // now we have the http string of the twitter pic (without quotes)
}So I've tried theming using yourtheme_preprocess_user_picture in template.php with no success. If anyone could provide some guidance it would be awesome as this is driving me mental. I realize there are TOS for caching user profile info fetched from social sites, but I would simply address that as part of the registration process. I'm also using image cache and would also like to incorporated avatar selection module. In an ideal world, the user would register with a social network, choose first if they want to use that avatar for drupal, if not they can choose one from avatar selector or upload their own. Even cleaner would be to place the social avatar within one of the available avatars in avatar selector.
Also I can't seem to figure out how to pre-populate User fields with social network data. Huge thanks to anyone who can help. I am of course trying to accomplish this through theming unless there's another way.
-wil
Comments
#1
Try again on 2.0 with #742430: Patch to fix several bugs and let us know if it works. The prepopulation should work now.
#2
Prepopulation of social network info works but the current version of the module (even with #742430: Patch to fix several bugs ) doesn't support avatars.
#3
Postponing for now, but should be on the roadmap. (I haven't created that issue yet.)
#4
#551290: Avatar used from Facebook not visible by Views & #721022: How to Show User Pictures for User Accounts seem related - which one(s) should be flagged as duplicate?
#5
For Facebook, this can be done quite easily in a preprocess function using the following two lines of code, assuming that $fbuid (the Facebook user ID) is already known:
<?php$alt = t("@user's picture", array('@user' => $account->name));
$vars['user_picture'] = theme('image', 'http://graph.facebook.com/' . $fbuid . '/picture', $alt, $alt, '', FALSE);
?>
This uses the new Facebook Open Graph API which exposes much more data in a much simpler way than previous Facebook APIs.
Does Gigya store the Facebook user ID for a given user somewhere? If so, this method could easily solve this problem. Of course, other social network services would require different functions.