Enabling WordPress Facebook login for existing user

December 12th, 2010  |  Published in hacks

I’m using the WP-FacebookConnect plugin to let users log in using their Facebook accounts for some of the WordPress-based sites I’ve created. I noticed that Facebook login wasn’t enabled (and regular login was broken) for users I created through the Users page in the WordPress Admin. I found that manually assigning a variable that linked a user’s Facebook user ID to their WordPress user ID did the trick.

This is the SQL query I used:

INSERT INTO `wp_usermeta` ( `umeta_id` , `user_id` , `meta_key` , `meta_value` )
VALUES (
'', '1', 'fbuid', '111111111'
);

In the above example, replace ‘1’ with your user’s WordPress user ID (which you can get from the URL of the user edit page in WordPress) and ‘111111111’ with the user’s Facebook ID (which you can find by viewing the user’s Facebook profile, viewing the source of the page and searching for the string “uid”.