Download & Extend

Ability to post to Facebook for nodes with no title

Project:Drupal for Facebook
Version:7.x-3.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

I have been using the Title module, and my blog posts have the mandatory title replaced with a field (title_field), which sometimes remains empty. I have finally tested posting to Facebook with Drupal for Facebook, and it works. It turns out , however, that nodes with an empty title field are not posted to Facebook.
I understand that there are UI issues to consider (e.g., where to provide a clickable link to the node in a Facebook wall post if the node has no title), but I still hope it will be possible to implement this feature.

Comments

#1

Thanks for reporting this.

It sounds like the module could be improved with a sanity check, to make sure the facebook post has all the required data. however, the module will not be able to magically know about your content types title_field, I don't think.

You can work around this by implementing hook_fb_stream(). When $op == FB_STREAM_OP_PRE_POST, that hook can modify the data structure before it is passed to facebook. Something like...

<?php
function custom_fb_stream($op, $data, &$return) {
  if (
$op == FB_STREAM_OP_PRE_POST) {
    if (!
$return['name']) {
     
$return['name'] = "the title from your field goes here.";
    }
  }
}
?>

#2

It sounds like the module could be improved with a sanity check, to make sure the facebook post has all the required data.

Hmm, sorry if I sound stupid, but "required" by whom? My understanding was (please correct me if I am wrong) that Facebook does not require that title...

#3

There's actually code already in there that ensures the link has a name. I can remember exactly when I added that, but I'm pretty sure I added it because facebook required it. Looks like the module should write to the log or print a message so folks don't have to track it down.

Please correct me if I'm wrong as well. You could change the code to skip that check and let me know if it posts without a title.