Hi could you please add a block that only has fbconnect button? Or even just a standalone form that can be called from code?

I tried doing this myself, but something about the javascript that should run on the page (I think) means that it didn't work.

As a work around hack, I've form_altered the user login block to hide the user/pass stuff. Pasting here for others:

function MYMODULE_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'user_login_block') {
    if ($_GET['destination'] != 'fbconnect') {  // Line copied from fbconnect module, not sure of significance.
      $form['pass']['#type'] = 'hidden';
      $form['name']['#type'] = 'hidden';
      unset($form['links']);
      $form['submit']['#type'] = 'hidden';
    }
  }
}

Comments

mbeach1’s picture

There's a way to do it, but its kindof an ugly workaround.

From your site, logged out, view page source and look for something like the following:

<fb:login-button size="medium" length="short" onlogin="facebook_onlogin_ready();" background="dark" v="2">Login using Facebook</fb:login-button>

Copy that code and insert it into a block. Make sure you are using an input method that is not filtered.

If you change any of the button settings through site configuration, that code will change but you will have to update your block manually.

sime’s picture

Thanks mbeach1, great to know :)

vectoroc’s picture

Perhaps you can use fbconnect_render_button() instead

sime’s picture

My first attempt was to use this in a form called from some custom block code. It didn't work for me it and I sensed that some events/click handlers weren't properly attached. I didn't understand what was going on enough to debug it.

      $form['fbconnect_button'] = array(
        '#type' => 'item',
        '#description' => t('Sign in using Facebook'),
        '#value' => fbconnect_render_button(),
        '#weight' => 1,
        '#id' => 'fbconnect_button',
      );
venusrising’s picture

The problem is if you paste the code an in a block and then click a login link the block turns into

Does anyone know why this happen when the regular Drupal login link is clicked?

venusrising’s picture

Status: Active » Needs work
core44’s picture

Version: » 6.x-2.x-dev

Id really like to achieve this too, did anyone manage to get this working properly?

giorgio79’s picture

Been looking for this just now, would be a great feature. Looking to turn off the regular Drupal user login block and just have FB Connect.

giorgio79’s picture

Status: Needs work » Closed (duplicate)