Thanks for the nice module. We are currently building sites in which the Facebook account is part of the user profile content type (using Content Profile), and I am looking into ways of integrating a CCK field with the Fbconnect module, so it is easy and straightforward for the user to enter his or her Facebook account details. One of the ways I am considering is to have a "social" CCK field (much like emfield) that contains this data, and have modules like Fbconnect use this data. I have written this up in more detail here: http://groups.drupal.org/node/26157

What do you think about this approach? Would this be considered for integration with this module?

Comments

Anonymous’s picture

I think integrating with Content Profile is quite a major feature for Facebook Connect. I have used Facebook Connect with Core Profile by simply adding this code fbconnect.pages.inc (You will notice I pulling in the following user data, First Name, Last Name, Country, Gender, this method works for both the Facebook Fast Registration and Standard Registration):

function fbconnect_register_page() {
  $site  = variable_get('site_name', t('this website'));
  $fbuid = fbconnect_get_fbuid();
  $data  = fbconnect_get_info_from_fb($fbuid, 'name, proxied_email, first_name, last_name, hometown_location, locale, sex');    
  $form  = drupal_retrieve_form('user_register', $form_state);
  $fullname = $data['first_name'] .' '.$data['last_name'];
if($data['sex'] == 'male') {
	$gender = 'Male';
}elseif($data['sex'] == 'female') {
	$gender = 'Female';
}
  
  drupal_prepare_form('user_register', $form, $form_state);  
    $form['account']['name']['#default_value'] = $data['name'];
	$form['account']['mail']['#default_value'] = $data['proxied_email'];
	$form['Profile']['profile_name']['#default_value'] = $fullname;
	$form['Profile']['profile_country']['#default_value'] = $data['hometown_location']['country'];
	$form['Profile']['profile_gender']['#default_value'] = $gender;
  $form['fb_visible'] = array(
    '#type' => 'checkbox',
    '#title' => t('Let my Facebook friends see me on @sitename', array('@sitename' => $site)),
    '#default_value' => 1,
  );
  
  if (variable_get('user_pictures', 0)) {
    $form['fb_avatar'] = array(
      '#type' => 'checkbox',
      '#title' => t('Use my Facebook picture as user picture'),
      '#description' => t('Your picture will be updated every 24 hours.'),
      '#default_value' => 1,
    );  
  }
  $form['#submit'][] = 'fbconnect_register_form_submit';  
  
  // Fast registration mode, we by pass std drupal reg form.
  if (variable_get('fbconnect_fast_reg', NULL)) {
    $form_state['values']['name']       = $data['name'];
    $form_state['values']['mail']       = $data['proxied_email'];
    $form_state['values']['pass']       = user_password();
    $form_state['values']['profile_name'] = $fullname;
    $form_state['values']['profile_country'] = $data['hometown_location']['country'];
    $form_state['values']['profile_gender'] = $gender;
    $form_state['values']['status']     = 1;
    $form_state['values']['fb_visible'] = 1;
    $form_state['values']['fb_avatar']  = 1;
    
    drupal_validate_form('user_register', $form, $form_state);
    if (form_get_errors()) {
      $dest = array('query' => 'destination=fbconnect');
      drupal_set_message(t('Facebook connect registration failed for the reasons listed. You may register now, or if you already have an account you can <a href="@login">log in</a> now and link your account', array('@login' => url('user/login', $dest))), 'error');
      drupal_goto('user/register');
    }
    
    fbconnect_register_form_submit($form, $form_state);
    drupal_goto();
  }
    
  return $form;
}

However, I think for connecting with facebook fields with Content Profile it would be much more useful designing an admin interface that allows administrators to link cck fields with available facebook fields. Because, if you were to just create one social cck field that imports all data, it's not going to provide the flexibility most people would need when working with individual field values.

Is anyone interested in working on this? Are there any plans for integration with Facebook Connect Module and Drupal Profiles?

rf-pldev’s picture

Just note that most of the data retrieved from FB this way would need to be refreshed every 24 hours and can't be used to get around FB display rules (i.e., you can't show any of my personal data you got from FB to people who aren't my FB friends -- except for some allowable public "Storable Data", which is very minimal). You could use cron to refresh the data as has been mentioned in other issues for this module, but that still doesn't allow you to show that info to everyone.

So while I think that using FB Connect for registration can be valuable, you don't want to break the TOS for some fairly minor benefit. Of course, in reality you can do whatever you want and most likely nobody will be the wiser, but I wouldn't recommend building a drupal.org hosted module that breaks a 3rd-party TOS.

some reference:
http://wiki.developers.facebook.com/index.php/Storable_Information
http://developers.facebook.com/news.php?blog=1&story=234
http://www.facebook.com/help.php?page=888
http://wiki.developers.facebook.com/index.php/Talk:Storable_Data

gallamine’s picture

Is there any update on this issue? Content Profile has around 15,000 users, so it would be a good module to play nicely with.

vectoroc’s picture

Status: Active » Closed (won't fix)

Comment from author of fbconnect module

I took the liberty to remove the submodule fbconnect_profile.
The fbconnect_profile module was restricted by the conditions of use of Facebook.