Facebook Login with User Registration - taken from http://eureka.ykyuen.info/2012/06/22/drupal-7-add-the-facebook-connect-login-button-on-user-registration-and-login-page/

Public

The $ss__facebook_connect is the HTML markup of the Facebook Login button. You can set it to the $vars in the preprocess function and then print it in corresponding .tpl.php. If you want to add the button in the registration and login page, create a custom module and implement the following hook_form_alter().

</> CopyGet raw version
php
  1. function <module>_form_alter(&$form, &$form_state, $form_id) {
  2. $user_profile = fbconnect_user_profile();
  3. $op = $user_profile ? 'login' : 'register';
  4. switch ($form_id) {
  5. case 'user_register_form':
  6. case 'user_login':
  7. $attr = array();
  8. if (variable_get('fbconnect_fast_reg', 0) && variable_get('fbconnect_reg_options', 0)) {
  9. $attr = array('perms' => 'email');
  10. }
  11.  
  12. $ss__facebook_connect = fbconnect_render_button($attr);
  13.  
  14. $form['fbconnect_button'] = array(
  15. '#type' => 'item',
  16. '#title' => t('Facebook login'),
  17. '#markup' => $ss__facebook_connect,
  18. );
  19. break;
  20. }
  21. }

To make a custom login page I have a custom block block–user–login.tpl.php and template.php defines the hook as

</> CopyGet raw version
php
  1. function MYTHEME_form_alter(&$form, &$form_state, $form_id) {
  2. /*drupal_set_message($form_id);*/
  3. if ($form['#id'] == 'user-login-form') {
  4. //dpm($form);
  5. $form['name']['#title'] = t("Custom title");
  6. $form['actions']['submit']['#value'] = t("Save");
  7.  
  8. $attr = array();
  9. if (variable_get('fbconnect_fast_reg', 0) &amp;&amp; variable_get('fbconnect_reg_options', 0)) {
  10. $attr = array('perms' => 'email');
  11. }
  12.  
  13. $ss__facebook_connect = fbconnect_render_button($attr);
  14.  
  15. $form['fbconnect_button'] = array(
  16. '#type' => 'item',
  17. '#title' => t('Facebook login'),
  18. '#markup' => $ss__facebook_connect,
  19. );
  20. }
  21. }