I've been trying out this codes from this blog, and tried a couple of snippets and my trials on the codes but have no luck at the moment.

This blog has (http://www.grasmash.com/article/connecting-facebook-drupal-easy-way) the following functions:

 * Implements hook_fboauth_user_properties_alter(). 
function grasmash_fboauth_user_properties_alter(&$properties) { 
  // Allow the location property to be mapped to Addressfield typed fields.   
  $properties['location']['field_types'][] = 'addressfield'; 

which this hook is available in D6

 * Implements hook_fboauth_field_convert_info().

function grasmash_fboauth_field_convert_info_alter(&$convert_info) { 
  $convert_info += array( 'addressfield' => array( 
    'label' => t('Address Field'), 
    'callback' => 'grasmash_fboauth_field_convert_location', 

This is never fired up, and seems i cannot find the hook in D6

 * Facebook data conversion function. 
 * Converts an incoming Facebook location (which is an object) into an array compatible with the addressfield module. 
function grasmash_fboauth_field_convert_location($facebook_property_name, $fbuser, $field, $instance) { 
  $value = NULL; 
  if ($field['type'] == 'addressfield' && isset($fbuser->location) && module_exists('geocoder')) { 
    $geodata = geocoder('google', $fbuser->location->name); 
    foreach ($geodata->data['geocoder_address_components'] as $key => $components) { 
      switch($components->types[0]) { 
        // Set city. 
        case 'locality': 
          $value['locality'] = $components->short_name; 
        // Set state. 
        case 'administrative_area_level_1': 
          $value['administrative_area'] = $components->short_name; 
        // Set country. 
        case 'country': 
          $value['country'] = $components->short_name; 
   return $value; 

This one is firedup when the second function is firedup, but the logic inside of this doesnt matter as long as $fbuser is available.

In totality my goal is to have access of the $fbuser after the user successfully connect to Facebook.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.