function social_content_facebook_post_callback in Social Content 7
2 string references to 'social_content_facebook_post_callback'
- hook_social_content_info in ./
social_content.api.php - Define social content types.
- social_content_facebook_social_content_info in modules/
facebook/ social_content_facebook.module - @file Social Content: Facebook module.
File
- modules/
facebook/ social_content_facebook.module, line 89 - Social Content: Facebook module.
Code
function social_content_facebook_post_callback(&$wrapper, $post, $external_id, $settings) {
if (!social_content_facebook_valid_post($post)) {
return FALSE;
}
$wrapper->created
->set(strtotime($post->created_time));
$body_text = social_content_validate_text($post->message);
$wrapper->body
->set(array(
'value' => $body_text,
'format' => 'filtered_html',
));
$image_field_name = 'field_facebook_picture';
$image_url = social_content_facebook_get_image_url($post, $settings);
$image_file = social_content_get_image_file($image_url, $image_field_name, $settings['min_resolution']);
if (!$image_file) {
return FALSE;
}
$wrapper->{$image_field_name}
->set($image_file);
$id_parts = explode('_', $external_id);
$fblink = 'http://www.facebook.com/' . $post->from->id . '/posts/' . $id_parts[1];
$wrapper->field_facebook_link
->set(array(
'url' => $fblink,
));
return TRUE;
}