Closed PabloStep closed 8 years ago
Here is code which extends function in auth.php to get users profile photo from FB (hope it's helpful):
case 'facebook': require_once($CFG->libdir . '/filelib.php'); require_once($CFG->libdir . '/gdlib.php'); $imagefilename = $CFG->tempdir . '/googleoauth2-portrait-' . $user->id; $imagecontents = download_file_content('https://graph.facebook.com/' . $userdetails->uid . '/picture?type=large'); file_put_contents($imagefilename, $imagecontents); if ($newrev = process_new_icon(context_user::instance($user->id), 'user', 'icon', 0, $imagefilename)) { $DB->set_field('user', 'picture', $newrev, array('id' => $user->id)); } unlink($imagefilename); break; default: // TODO retrieve other provider profile pictures. break; } }
I added it last year https://github.com/mouneyrac/moodle-auth_googleoauth2/commit/cdee52353830e7e729c3bb5f86ac11f64f1bbd24 but thanks anyway Pablo :)
Here is code which extends function in auth.php to get users profile photo from FB (hope it's helpful):