views:

210

answers:

2

I am trying to add the new Facebook log in button to my registration page on my Drupal site.

I know the following code is wrong, but I don't know the right syntax to implement it:

function facebook_user($op, &$edit, &$user, $category = NULL) { switch($op) { // User is registering. case 'register': // Add a Facebook login button. echo ' '; } }

What should I use instead of echo? Is there another way I should be going about this?

Thanks

+2  A: 

Use the right tool for the job: http://drupal.org/project/fbconnect

Oherwise:

You should be using hook_form_FORM_ID_alter() http://api.drupal.org/api/function/hook_form_FORM_ID_alter/6 or hook_form_alter() http://api.drupal.org/api/function/hook_form_alter/6 to alter the form, the form name is 'user_register" http://api.drupal.org/api/function/user_register/6

E.g., hook_form_user_register_alter($form, &$form_state) { $form['values']['facebook'] = array( '#type' => 'button', '#value' => 'Facebook Login' ' ); }

Or such as you see fit.

nowarninglabel
A: 

investigate this modules: http://drupal.org/project/facebook_auth , http://drupal.org/project/fbconnect

Nikit