Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profile picture from facebook #18

Open
tomu4 opened this issue Mar 16, 2022 · 0 comments
Open

Profile picture from facebook #18

tomu4 opened this issue Mar 16, 2022 · 0 comments

Comments

@tomu4
Copy link

tomu4 commented Mar 16, 2022

It would be nice if facebook_login plugin could also update user profile image with facebook one. It's super easy, I already tested that by modifiing code on my website, all that has to be done in fb-callback.php file is (bold represents changes to be done):

  • add line: $pic = "http://graph.facebook.com/".$fbuser['id']."/picture?type=large"; (in my case it's on line 118 right above user existance check)
  • edit fields line when user exists: $fields=array('fb_uid'=>$fbuser['id'], 'logins'=>$newLoginCount, 'last_login'=>$newLastLogin , 'picture'=>$pic); (in my edited version line 125, originally propably little bit higher)
  • edit fields line when user doesn't exist: $fields=array('email'=>$fbEmail,'username'=>$username,'fname'=>$fb_fname,'lname'=>$fb_lname,'permissions'=>1,'logins'=>1,'join_date'=>$date,'last_login'=>$date,'email_verified'=>1,'password'=>NULL,'fb_uid'=>$fbuser['id'] ,'picture'=>$pic); (in my case line 176, originally propably little bit higher)

And that is that. This simple edit gets URL of facebook profile image, which can than be used instead of Gravatar URL. This basically makes registration easier for users, because they don't need to upload their profile picture anywhere, it also automatically updates with facebook profile picture update.

I already sucessfully implemented and tested these changes on my website, I just thought someone else could appreciate it and they won't need to reinvent the wheel. If you don't think it's good idea to implement it or you find better solution, feel free to ignore this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant