Drupal : Login / register with Facebook connect button

×

Error message

  • Deprecated function: Return type of DatabaseStatementBase::execute($args = [], $options = []) should either be compatible with PDOStatement::execute(?array $params = null): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2244 of /var/www/html/drupaldeveloper.in/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseStatementEmpty::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2346 of /var/www/html/drupaldeveloper.in/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseStatementEmpty::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2346 of /var/www/html/drupaldeveloper.in/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseStatementEmpty::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2346 of /var/www/html/drupaldeveloper.in/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseStatementEmpty::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2346 of /var/www/html/drupaldeveloper.in/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseStatementEmpty::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 2346 of /var/www/html/drupaldeveloper.in/includes/database/database.inc).
  • Deprecated function: Return type of DatabaseCondition::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in require_once() (line 1652 of /var/www/html/drupaldeveloper.in/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property MergeQuery::$condition is deprecated in MergeQuery->__construct() (line 1344 of /var/www/html/drupaldeveloper.in/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1865 of /var/www/html/drupaldeveloper.in/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1865 of /var/www/html/drupaldeveloper.in/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1865 of /var/www/html/drupaldeveloper.in/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1865 of /var/www/html/drupaldeveloper.in/includes/database/query.inc).

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

    Drupal : Login / register with Facebook connect button | Drupal Developer

    Error

    The website encountered an unexpected error. Please try again later.