Is there anyway to publish to wall post (via new node create) with CCK field data (text, image, etc.)

Comments

Dave Cohen’s picture

Here's a description of customizing a wall post: http://drupal.org/node/685320

The trick is to get the image url from the cck field and put that url in the media data structure that facebook expects. If you figure it out please share your code.

khalor’s picture

Building on the example Dave posted, I think you'd be modifying the attachments array in the custom module to look something like this:

      $attachment = array(
        'name' => $node->title,
        'href' => url('node/' . $node->nid, array('absolute' => TRUE)),
        'description' => $node->teaser,
        'media': [{ 'type': 'image', 'src': imagecache_create_url('facebook_preset', $field_name_of_your_cck_imagefield_field[0]['filepath'], 'href': url('node/' . $node->nid, array('absolute' => TRUE))}]
      );

Note that it's being passed through imagecache with a given 'facebook_preset' setting, as Facebook has a 90x90 pixel limit on images that can be posted in streams. So you'll need imagecache to size your image accordingly.

I haven't tested this, so it (probably) doesn't work - but it's a starting point. Also it's probably worth looking into Facebook's attachments documentation

13rac1’s picture

Status: Active » Closed (fixed)

2.0 is deprecated. Closing old issue.