Drupal : Login / register with Facebook connect button

This CodeLet will add a facbook connect button to your login / registration form. Using the CSS, you can change the appearnce of the login block/page. This CodeLet also uses Ajax login/register module. Please make sure you have all the require modules and libraries installed before you using this CodeLet.

Drupal : Login / register with Facebook connect button
CodeLet: 

<?php

/**
* @filesource
*
* Different customization & enhancements to existing features for Channel portal
*
* @param $form
* @param $form_state
* @param $form_id
* DrupalD
*/

/**
* Implementation of hook_form_alter
*
* @param $form
* @param $form_state
* @param $form_id
* DrupalD
*/
function channel_utils_form_alter(&$form, &$form_state, $form_id) {
$user_profile = fbconnect_user_profile();
$op = $user_profile ? 'login' : 'register';
switch ($form_id) {
case 'user_register_form':
case 'user_login':
drupal_add_css(drupal_get_path('module', 'channel_utils') .'/fbappear.css');
$attr = array();
if (variable_get('fbconnect_fast_reg', 0) && variable_get('fbconnect_reg_options', 0)) {
$attr = array('perms' => 'email');
}
$ss__facebook_connect = fbconnect_render_button($attr);
$form['login_text'] = array(
'#markup' => 'Log in instantly with Facebook',
'#weight' => -50,
);
$form['fbconnect_button'] = array(
'#type' => 'item',
'#prefix' => '',
'#title' => t('Facebook login'),
'#markup' => $ss__facebook_connect,
'#weight' => -49,
);

$form['points_text'] = array(
'#markup' => '

  • Share what you love with your friends
  • See the videos your friends want to share
  • Improve your recommendations
  • ',
    '#prefix' => '

      ',
      '#suffix' => '

    ',
    '#weight' => -48,

    );

    $form['fb_divider'] = array(
    '#type' => 'item',
    '#prefix' => '',
    '#markup' => ' ',
    '#suffix' => '',
    '#weight' => -47,
    );

    $form['or'] = array(
    '#type' => 'item',
    '#prefix' => '',
    '#markup' => ''. t('OR') .'',
    '#suffix' => '',
    '#weight' => -46,
    );

    $form['name']['#size'] = 40;
    $form['pass']['#size'] = 40;

    break;
    }
    }

    Info file details: 

    name = Channel portal Utilities
    description = Customization & enhancements to existing features.
    core = 7.x
    dependencies[] = fbconnect
    package = Channel

    Compatibility: 
    Is CodeLet useful?: 

    Comments

    DrupalD's picture

    This site uses this customization. You can check it by navigation to http://drupaldeveloper.in/user/login