emersonthis
emersonthis

Reputation: 33398

Creating new Wordpress users with Facebook API

I'm trying to allow new users to register for my Wordpress site using their Facebook account. I know how to create a new user manually, but I'm not sure how to handle situations in which a user has already registered for the site with an email address that's different from their facebook account.

I need to create an official WP user, but I don't want pre-existing users to end up with two different acccounts (if their Facebook email doesn't match their pre-existing email). I'm not sure if there is a way to assign multiple emails to one account. Even if there is, I suspect this will be problematic.

What's the best way to handle this?

Upvotes: 1

Views: 280

Answers (1)

emersonthis
emersonthis

Reputation: 33398

In case anyone cares, I added a meta field to the new user when the user is created. This is easy to do with update_user_meta(). This meta field holds the user's facebook id, so I can check to see if it already exists every time I create a new user. Also easily done with get_users().

Upvotes: 2

Related Questions