Warning message

Newsletter category Drupal Developer newsletter format has not been set to HTML. There will be no statistics recorded for this newsletter.

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.

Module Info

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

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(
'' => 'Log in instantly with Facebook',
'' => -50,
);
$form['fbconnect_button'] = array(
'' => 'item',
'' => '',
'' => t('Facebook login'),
'' => $ss__facebook_connect,
'' => -49,
);

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

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

    ',
    '' => -48,

    );

    $form['fb_divider'] = array(
    '' => 'item',
    '' => '',
    '' => ' ',
    '' => '',
    '' => -47,
    );

    $form['or'] = array(
    '' => 'item',
    '' => '',
    '' => ''. t('OR') .'',
    '' => '',
    '' => -46,
    );

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

    break;
    }
    }

    Drupal : Login / register with Facebook connect button

    By DrupalD on Mon, 09/12/2013 - 5:19pm

    Comments

    #1
    DrupalD's picture

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

    Add comment

    Log in or register to post comments
    QR code for this page URL This page URL
    Feedback