I would like to use the Facebook Registration tool.
I've read the documentation on https://developers.facebook.com/docs/plugins/registration/
I've also gave a look at plugins like Simple Facebook Connect http://wordpress.org/extend/plugins/simple-facebook-connect/ - However my setup is quite customized and I don't use regular Wordpress registration and login forms (I use Theme My Login plugin for Login and Gravity Forms plugin for Registration), which is where Simple Facebook Connect hooks into (plus with Gravity Forms I have standard user registration disabled altogether - that also helps to keep spammers away).
I thought, maybe I can place a Facebook login button somewhere in the header (where I have a login form with TML) and a create a register-with-facebook page template for handling the registration, using this button as mentioned in the Facebook doc:
<fb:login-button registration-url="https://developers.facebook.com/docs/plugins/registration" />
// If the user arrives at your site logged out of Facebook, the button will say Login.
// When the user clicks it, she will be prompted to enter her Facebook username and password.
// If she has not registered for your site, she will be redirected to the URL you specify in the registration-url parameter.
// If she has already registered for your site, the button will fire an onlogin() Javascript event. When this event is fired you should login the user to your site.
In the special facebook registration page I would have something like:
<fb:registration
fields="name,birthday,gender,location,email"
redirect-uri="https://developers.facebook.com/tools/echo/"
width="530">
</fb:registration>
(these are untouched examples from the Facebook documentation)
Now, for the tricky part, how do I filter the JSON output from Facebook and tell Wordpress to fetch the data, check if the user exists already or not, if not register a new user otherwise perform a login? Especially if I don't use the above code in a Wordpress standard login/registration page/form?