facebook connect button on custom form

I have a custom form to log in. I would like to put the button on that form.
I tried this code, but it does only displays in text "connect with facebook" without an image and it is not clickable.

$form['fb_connect_button'] = array(
'#type' => 'markup',
'#value' => 'Connect with Facebook',
'#prefix' => '',
'#suffix' => '',
);

Can someone hel p me to properly display the button on that form?

Thanks !

Dave Cohen's picture

Try something like:

Try something like:

      // Add button to the form.
      $form['fb_connect_button'] = array(
        '#type' => 'markup',
        '#value' => '<fb:login-button v="2"><fb:intl>Connect with Facebook</fb:intl></fb:login-button>',
        '#prefix' => '<div class="form-item" id="fb-connect-button">',
        '#suffix' => '</div>',
      ); 

solved

Apparently the facebook application you add on your drupal site has to be published. Else no button is displayed.

problem not solved

Dave

Thanks for your reply. Apparently something went wrong with my copy/past. The code I have is the same as what you suggested. I analyzed it further and was able to compare to a test site I have where drupal for facebook is working. On the working site I see 2 scripts from static.ak.connect.facebook.com.
On the site I'm implementing drupal for facebook I don't see those scripts. What could possibly go wrong? I have followed the installation steps. It is installed the same way on both sites.
Any suggestions?

Dave Cohen's picture

On the Facebook Application

On the Facebook Application node, check the box to make it the "primary" app. That way the javascript will always be loaded.

I'll soon check in a way to automatically add a connect button the the login form.

fbConnect aware themes

Have you tried this? Worked for me.
http://www.drupalforfacebook.org/node/1106