I'm having the following problem, I'd like to use the "title" token in my feed story but I get the following error:

"Application response error

Supplied template data does not cover the following tokens [title] needed for template '{*actor*} just added {*title*}.' You can see this because you are one of the developers of the app."

So, I've setup a module with the following hook:

function fb_feed_story_fb_feed_show_dialog_alter(&$params){
$params['tokens'] = array('[title]' => 'test');
//kpr($params);die;
}

But that doesn't quite seem to do the trick... I'm assuming I don't know the proper way to set the $params['tokens'] field. Has anyone successfully done this before? If so, can you point me in the right direction of how to set this field to replace the value of the token "{*title*}" with "test"?

Comments

nighthawk117’s picture

Also tried array('title' => 'test');

nighthawk117’s picture

Ok, I've done a deeper dive on this and it appears that if I use the following hook:

function fb_feed_story_fb_feed_show_dialog_alter(&$params){
  $params['tokens'] = array('title' => 'test');
}

AND I modify fb_feed.module line 601 to read

$args[] = json_encode(array_merge($d['options'][$key], $d['tokens']));

then everything works! So, it seems this is a bug in fb_feed.module...

Dave Cohen’s picture

$params['tokens'] helps you to use Drupal tokens when showing feed dialogs. And the drupal token api uses a strange data structure not at all like what you're creating.

Instead, use the alter hook to add your values to $params['options']['template_data']. This will be passed to the showfeeddialog function the way you expect. And you can alter other parameters to the function, see http://wiki.developers.facebook.com/index.php/Facebook.showFeedDialog.

And undo the change you've made to line 601. That will break the handling of the other parameters.

nighthawk117’s picture

Thanks Dave, that works. I guess this is obvious to people more familiar with Drupal!

Dave Cohen’s picture

Status: Active » Fixed

Not obvious to anyone, really. I tried to make the parameters reflect the documentation of the facebook methods. But there's little rhyme or reason to what they do over there at facebook.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.